FtpDeleteFilesOlderThanSpecifiedDate

Top  Previous  Next

 

The FtpDeleteFile command allows you to delete all files in a specified location that are older than a specified date using FTP or SFTP transfer protocols.

 

Command Syntax

 

FtpDeleteFilesOlderThanSpecifiedDate:[RemoteDirectory],[CheckDate],[Host]],[Port],[UserName],[Password,[Protocol]

 

The colon after the command and the commas between parameters are compulsory. Any additional spaces or characters will cause an error to be thrown. The command itself is not case sensitive, but parameters may be depending on the operating system and locale.

 

Parameters:

 

RemoteDirectory: The fully qualified identifying the directory containing the file(s) to delete. This value must be enclosed in quotes if there are any spaces in the the path

CheckDate: The date to check against. This will be converted into a date for comparison purposes, so must be in a format that is compatible with your locale and operating system.

Host:The FTP or SFTP server to receive the Delete command

Port: The port on which the server will communicate

UserName: The username for the server

Password: The password for the server

Protocol: A string representing a valid transport protocol, currently one of the following values: FTP, FTPS, SFTP

 

All parameters are compulsory. If any parameter is missing or invalid an error will be thrown.

 

Example:

 

; Delete all files older than 26th June 2024

FtpDeleteFilesOlderThanSpecifiedDate:"/home/www/test/files","2024-06-26",my.server.com,22,MyUserName,mypassword,SFTP

 

See Also: FtpDeleteFile FtpDeleteFilesOlderThanXDays FtpDownload FtpUpload