Function Reference


_FTP_ListToArrayEx

Get names, sizes, attributes and times of files/dir of current remote directory

#include <FTPEx.au3>
_FTP_ListToArrayEx ( $hFTPSession [, $iReturnType = 0 [, $iFlags = $INTERNET_FLAG_NO_CACHE_WRITE [, $iFmt = 1 [, $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().
$iFmt [optional] type on the date strings:
    1 = yyyy/mm/dd
    0 = mm/dd/yyyy
$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:
    $Array[0][0] = number of found entries
    ...
    $Array[n][0] Filename
    $Array[n][1] Filesize
    $Array[n][2] FileAttribute
    $Array[n][3] File Modification datetime
    $Array[n][4] File Creation datetime
    $Array[n][5] File Access datetime
Failure: $Array[0][0] = 0.

Related

_FTP_Connect, _FTP_SetStatusCallback

Example

#include <Array.au3>
#include <FTPEx.au3>
#include <MsgBoxConstants.au3>

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

Local $hOpen = _FTP_Open('MyFTP Control', 0)
If Not @error Then
    ; passive allows most protected FTPs to answer
    Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass)
    If Not @error Then
        Local $aFile = _FTP_ListToArrayEx($hConn, 0)
        If Not @error Then
            _ArrayDisplay($aFile)
        Else
            MsgBox($MB_SYSTEMMODAL, "Error", '_FTP_ListToArrayEx($Conn, 0)' & @CRLF & _
                    '@error = ' & @error & ' @extended = ' & @extended)
        EndIf
        Local $iFtpc = _FTP_Close($hConn)
    Else
        MsgBox($MB_SYSTEMMODAL, "Error", '_FTP_Connect($Open, ' & $sServer & ', ' & $sUsername & ', ' & $sPass & ')' & @CRLF & _
                '@error = ' & @error & ' @extended = ' & @extended)
    EndIf

    Local $iFtpo = _FTP_Close($hOpen)
Else
    MsgBox($MB_SYSTEMMODAL, "Error", "_FTP_Open('MyFTP Control')" & @CRLF & _
            '@error = ' & @error & ' @extended = ' & @extended)
EndIf