wwftp::aFTPDir

This method retrieves a directory listing from an FTP directory into an array. The array returns the name, file attributes and size of the file.

o.aFTPDir(@aFiles,cFileSpec)

Return Value

numeric - the number of files returned by the directory. If this value is 0 you can check the nError and cErrorMsg properties for error conditions, but only if an error occurred.

Parameters

@aFiles
Array that contains the list of files. The array has 4 dimensions:

1 - Filename 2 - File Size 3 - File Attribute (numeric) 4 - Date Time value

cFileSpec
A filespec that specifies which directory to get a listing for. The file spec should include wild card characters like . to specify all files or *.txt to show all text files.

Remarks

This method requires that you manually call FTPConnect and FTPClose to open and close the FTP session.

Example

oFTP = CREATE("wwFTP")

*** Note: Login may not be required
oFTP.FTPConnect("ftp.west-wind.com","jdoe","hispassword")

DIMENSION laFiles[1,4]
lnResult = oFTP.aFTPDir(@laFiles,"/*.*")
FOR x=1 to lnResult
   ? laFiles[x,1],laFiles[x,2],laFiles[x,3], laFiles[x,4]
   * ? oFTP.FTPDeleteFile("/" + laFiles[x,1]) 
ENDFOR

oFTP.FTPClose()

See also:

Class wwftp

© West Wind Technologies, 1996-2019 • Updated: 01/01/17
Comment or report problem with topic