wwftp::aFTPDir

This method retrieves a directory listing from an FTP directory into an array. The array returns:

  • File name
  • File Size
  • File attributes (16 - Directory, 128 - File)
  • File DateTime
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 (deprecated)

© West Wind Technologies, 2024 • Updated: 01/30/20
Comment or report problem with topic