Function Reference


_FTP_FindFileFirst

Find First File on an FTP server

#include <FTPEx.au3>
_FTP_FindFileFirst ( $hFTPSession, $sRemotePath, ByRef $hFTPFind [, $iFlags = 0 [, $iContext = 0]] )

Parameters

$hFTPSession as returned by _FTP_Connect().
$sRemotePath path to be used when searching the file.
$hFTPFind returns Handle to be used in _FTP_FindFileNext() or _FTP_FindFileClose().
$iFlags [optional] $iFlags can be a combination of :
    $INTERNET_FLAG_HYPERLINK (0x00000400)
    $INTERNET_FLAG_NEED_FILE (0x00000010)
    $INTERNET_FLAG_NO_CACHE_WRITE (0x04000000)
    $INTERNET_FLAG_RELOAD (0x80000000)
    $INTERNET_FLAG_RESYNCHRONIZE (0x00000800)
$iContext [optional] A variable that contains the application-defined value that associates this search with any application data.
This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: an array:
[0] - Number of elements
[1] - File Attributes
[2] - Creation Time Low
[3] - Creation Time Hi
[4] - Access Time Low
[5] - Access Time Hi
[6] - Last Write Low
[7] - Last Write Hi
[8] - File Size High
[9] - File Size Low
[10] - File Name
[11] - Altername
Failure: 0 and sets the @error flag to non-zero.

Related

_FTP_FindFileClose, _FTP_FindFileNext, _FTP_SetStatusCallback

See Also

Search FtpFindFirstFile in MSDN Library.

Example

#include <FTPEx.au3>

;~ Local $sServer = 'ftp.cs.brown.edu' ; Brown Computer Science
Local $sServer = 'speedtest.tele2.net' ; Tele2 Speedtest Service
Local $sUsername = ''
Local $sPass = ''

Local $hOpen = _FTP_Open('MyFTP Control')
Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass)

Local $h_Handle
;~ Local $aFile = _FTP_FindFileFirst($hConn, "/pub/papers/graphics/research/", $h_Handle)
Local $aFile = _FTP_FindFileFirst($hConn, "/", $h_Handle)
ConsoleWrite('$sFileName = ' & $aFile[10] & ' attribute = ' & $aFile[1] & '  -> Error code: ' & @error & @CRLF)

Local $iFindClose = _FTP_FindFileClose($h_Handle)

Local $iFtpc = _FTP_Close($hConn)
Local $iFtpo = _FTP_Close($hOpen)