- Example: Identifying the attributes of a file found on an FTP server.
Example: Identifying the attributes of a file found on an FTP server.
This example is used to retrieve the date of the last modification and the attributes of the "Readme.txt" file found on the "ftp.cdrom.com" FTP site. The attributes are retrieved without specifying the name of the file to avoid a new request to the server.
Remark: The second syntax used to retrieve the attributes of a specific file is presented in comments.
nConnection is int
// Connection to the FTP site
nConnection = FTPConnect("ftp.cdrom.com")
// Retrieve the date of the "Readme.txt" file
sDate is string
sDate = FTPDate(nConnection, "Readme.txt")
// Retrieve the attributes of the file
// Syntax 1: avoids a second request to the server
sAttribute is string
sAttribute = FTPAttribute()
// Syntax 2: a new request is sent to the server
// sAttribute = FTPAttribute(nConnection, "Readme.txt")
// IF "R" appears in the file attributes, a message is displayed
IF Position(sAttribute, "R") <> 0 THEN
Info("This file is read only")
This page is also available for…