General
cancel
Showing results for 
Search instead for 
Did you mean: 

howto delete files via ftp from cron job ?

SOLVED
Go to solution
'chris'
Super Advisor

howto delete files via ftp from cron job ?

hi

I use this command from cron job

15 5 * * * root tar Pcj /usr/local/httpd | ncftpput -c -u -p /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
chris
2 REPLIES
Jerome Henry
Honored Contributor
Solution

Re: howto delete files via ftp from cron job ?

Hi,
there is no ncftpput equivalent for rm.
But if your user has rm rights on remote dir, you can change to a stuff looking like :
15 5 * * * root tar Pcj /usr/local/httpd | ncftp -c -u -p / & rm save-`date +%Y.%m.%d-%H%M`.tar.bz2

hth

J
You can lean only on what resists you...
'chris'
Super Advisor

Re: howto delete files via ftp from cron job ?

thanks Jerome

greetings
chris