WebFtpRenameFile Function

Action

Renames a file or directory stored on the FTP server.

Include file

WebAPI.bdh

Syntax

WebFtpRenameFile( in hFtp         : number, 
                  in sOldFilename : string, 
                  in sNewFilename : string ) : boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hFtp Valid handle to an FTP session
sOldFilename String that contains the name of the file that will have its name changed on the remote FTP server
sNewFilename Null-terminated string that contains the new name for the remote file
Note: The sOldFilename and sNewFilename parameters can be either partially or fully qualified file names relative to the current directory. A backslash (\) or forward slash (/) can be used as the directory separator for either name. WebFtpRenameFile translates the directory name separators to the appropriate character before they are used.

Example

// Rename a file on the FTP server. 
dcltrans 
  transaction TWebFtpDir 
  var
    hFtp: number; 
  begin
    WebFtpConnect(hFtp, "standardhost", WEB_PORT_FTP, 
                 "anonymous", "mymail@address.com"); 
    WebFtpRenameFile(hFtp, "test_file.txt","renamed_test_file.txt");
    WebFtpShutdown(hFtp); 
  end TWebFtpDir;

SilkEssential sample

Ftp.sep