FtpDeleteFilesOlderThanX

Top  Previous  Next

 

The FtpDeleteFilesOlderThanX command allows you to delete all files in a specified location that are older than specified number of days using FTP or SFTP transfer protocols.

 

Command Syntax

 

FtpDeleteFilesOlderThanX:[RemoteDirectory],[DateTimeComponent],[DateTimeComponentCount],[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

DateTimeComponent: A string representing a valid date and time component, currently one of the following values: Day, Hour, Millisecond, Minute, Month, Second, Week, Year

DateTimeComponentCount: The number of the DateTimeComponent to use to generate the check date.

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 more than 30 days old using the SFTP protocol

FtpDeleteFilesOlderThanX:"/home/www/test/files",Day,30,my.server.com,22,MyUserName,mypassword,SFTP

 

See Also: FtpDeleteFile FtpDeleteFilesOtherThanTopNMostRecent FtpDeleteFilesOlderThanSpecifiedDate FtpDownload FtpUpload