howto delete files via ftp from cron job ?
hi
I use this command from cron job 15 4 * * * root tar Pcj /usr/local/httpd | ncftpput -c -u <your_username_on_remote_host> -p <your_pass_on_remote_host> <remote_host> <directory_on_remote_host>/save-`date +%Y.%m.%d-%H%M`.tar.bz2 to save daily via ftp the whole Web server data it's working well. but now I have a lot backup files ! how to use this and delete at the same time all old ones backup files ? kind regards cccc |
I'm using the find command to delete the backup files which have a modification time ( mtime ) greater than 90 days. Modification time in this case is when the file is created.
You may be able to change this to meet your needs. :) #!/bin/bash filename=`date '+%m%d%y'` tar -cvzf /mnt/backup/${filename}.tar.gz /home #Delete old files with the following command find /mnt/backup -type f -name '*.gz' -mtime +90 -exec rm {} \; |
thanks,
I will try this... kind regards cccc |
All times are GMT -5. The time now is 01:43 AM. |