Function Reference


_FTP_ListToArray2D

Get Filenames and filesizes of current remote directory

#include <FTPEx.au3>
_FTP_ListToArray2D ( $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: a 2D array with names and size:
    $Array[0][0] = number of found entries
    ...
    $Array[n][0] Filename
    $Array[n][1] Filesize
Failure: $Array[0][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_ListToArray2D($hConn, 0)
ConsoleWrite('$sFileName = ' & $aFile[0][0] & '  -> Error code: ' & @error & @CRLF)
ConsoleWrite('$sFileName = ' & $aFile[1][0] & ' size = ' & $aFile[1][1] & @error & @CRLF)
ConsoleWrite('$sFileName = ' & $aFile[2][0] & ' size = ' & $aFile[2][1] & @CRLF)

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