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 (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.

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, _FTP_ListToArray2D, _FTP_ListToArrayEx

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 $aFile = _FTP_ListToArray($hConn, 0)
ConsoleWrite('$NbFound = ' & $aFile[0] & '  -> Error code: ' & @error & @CRLF)
ConsoleWrite('$sFileName = ' & $aFile[1] & @CRLF)

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