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 (0x04000000). 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] = file name
    $Array[n][1] = file size
    $Array[n][2] = file attribute
    $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, _FTP_ListToArray, _FTP_ListToArray2D

Example

#include <Array.au3>
#include <FTPEx.au3>
#include <MsgBoxConstants.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', 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