WebFtpGetCurrentDirectory Function

Action

Retrieves the current directory for the specified FTP session.

Include file

WebAPI.bdh

Syntax

WebFtpGetCurrentDirectory( in  hFtp              : number, 
                           out sCurrentDirectory : string, 
                           in  nMaxDir           : number optional ): 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.
sCurrentDirectory A string that receives the current directory name, which specifies the absolute path to the current directory.
nMaxDir Maximum length of the string to put into sCurrentDirectory (optional).

Make sure the length of the string is greater than or equal to nMaxDir. If the sCurrentDirectory buffer is not large enough, nMaxDir receives the number of bytes required to retrieve the full, current directory name.

Example

// Connects to the FTP server and retrieves the current directory. 
dcltrans 
  transaction TWebFtpDir 
  var
    hFtp : number;
    sDirName : string(MAX_PATH); 
  begin
    WebFtpConnect(hFtp, "standardhost", WEB_PORT_FTP, 
                    "anonymous", "mymail@address.com"); 
    WebFtpGetCurrentDirectory(hFtp, sDirName);
    WebFtpShutdown(hFtp); 
  end TWebFtpDir;

SilkEssential sample

Ftp.sep