Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
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