Get Filenames and filesizes of current remote directory
#include <FTPEx.au3>
_FTP_ListToArray2D ( $hFTPSession [, $iReturnType = 0 [, $iFlags = $INTERNET_FLAG_NO_CACHE_WRITE [, $iContext = 0]]] )
$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 (0x04000000). 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. |
Success: | a 2D array with names and size: $Array[0][0] = number of found entries ... $Array[n][0] = file name $Array[n][1] = file size |
Failure: | $Array[0][0] = 0 |
_FTP_Connect, _FTP_SetStatusCallback, _FTP_ListToArray, _FTP_ListToArrayEx
#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 $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)