FTP - Automatic Removal Of Backup Files By Date

Step 1: Download FTP_Delete_By_Date

Download ftp_delete_by_date.php and upload the file to your php enabled server. Download Now!

Step 2: Find correct path to php.

Open the phpinfo.php file included in the FTP Delete download in a browser window. Note the full path to php listed at the bottom of the page.

Step 3: Edit ftp_delete_by_date.php.

Add the ftp connection details to the file as needed. Set the $daysbackup value to the age in days at which files will be deleted. Setting this value to 7 for a folder containing daily backups will result in 7 days of backups being stored.

Step 4: Create CronJob/Scheduled Task.

Use the full path to PHP from step 2 to create a cronjob that triggers ftp_delete_by_date.php once daily.

Example Cron Command:
1 0 * * * /your/full/path/to/php -q /path/to/ftp_delete_by_date.php >> ~/ftp_delete_log.txt

Be sure to adjust the file path as needed for your installation.

  • 134 Users Found This Useful
Was this answer helpful?

Powered by WHMCompleteSolution