WebFtpGetFileTime Function

Action

Retrieves the file date and time properties of a remote file, enumerated using WebFtpFindFirstFile/WebFtpFindNextFile functions.

Include file

WebAPI.bdh

Syntax

WebFtpGetFileTime( in  hFtp  : number, 
                   out uDate : number,
                   out uTime : number,
                   in  eTime : number): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hFtp Valid handle to an FTP session. This handle must have been returned from a previous call to WebFtpConnect.
uDate Variable that receives the file date property with format YYYYMMDD.
uTime Variable that receives the file time property of the current day in seconds.
eTime Specifies which file time property should be retrieved. The following options are supported:
  • WEB_FTP_FILETIME_CREATED
  • WEB_FTP_FILETIME_MODIFIED
  • WEB_FTP_FILETIME_ACCESSED

Example

Note: The uDate and uTime variables are ready to be passed to the FormatDateTime function to convert the timestamp into a readable format.
dcltrans 
  transaction TGetFileSize 
  var
    hFtp      : number;
    fFileSize : float;
    nDate     : number;
    nTime     : number;
    sFileName : string;
    sDateTime : string;  
  begin
    WebFtpConnect(hFtp, "localhost", WEB_PORT_FTP, "user", "pass");
    WebFtpFindFirstFile(hFtp, "testfile.txt", sFileName); 
    WebFtpGetFileSize(hFtp, fFileSize); 
    Print("The file " + sFileName + " has " + fFileSize + " bytes."); 

    WebFtpGetFileTime(hFtp, nDate, nTime, WEB_FTP_FILETIME_MODIFIED);
    FormatDateTime(nDate, nTime, "%Y-%m-%d %H:%M:%S", sDateTime);
    Print(sFilename + " modified time is " + sDateTime);

    WebFtpShutdown(hFtp); 
  end TGetFileSize;