Function Reference


_FTP_ListToArray

Get Filenames, Directories or Both of current remote directory

#include <FTPEx.au3>
_FTP_ListToArray ( $hFTPSession [, $iReturnType = 0 [, $iFlags = $INTERNET_FLAG_NO_CACHE_WRITE [, $iContext = 0]]] )

Parameters

$hFTPSession as returned by _FTP_Connect().
$iReturntype [optional] 0 = Both Files and Directories, 1 = Directories, 2 = Files.
$iFlags [optional] default = $INTERNET_FLAG_NO_CACHE_WRITE. See _FTP_FindFileFirst().
$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 containing the names. $Array[0] contain the number of found entries.
Failure: $Array[0] = 0

Related

_FTP_Connect, _FTP_SetStatusCallback

Example

#include <FTPEx.au3>

Local $sServer = 'ftp.csx.cam.ac.uk'
Local $sUsername = ''
Local $sPass = ''

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

Local $aFile = _FTP_ListToArray($hConn, 2)
ConsoleWrite('$NbFound = ' & $aFile[0] & '  -> Error code: ' & @error & @CRLF)
ConsoleWrite('$sFileName = ' & $aFile[1] & @CRLF)

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