Using "find" in a script..

WipeOut wipe_out at users.sourceforge.net
Tue Apr 20 14:51:08 UTC 2004


Hi,

I am creating a script to do a file backup but I am having isues with 
cleaning out the older backups..

Basically each backup goes into a seperate directory named by date and 
time and I want to remove the directories that are 15 days or more old.. 
there will probably be 3 to 4 backups per day..

The command that should do its is..

find /backups/fcws/ -mtime +15 -maxdepth 1 -type d -exec rm -rf {};

The problem is that because there are currently no directories to delete 
I get the error..

find: missing argument to `-exec'

Anyone got any ideas? to avoid this?

Otherwise I am going to have to create an "if" routine to test first if 
there are any to delete and if there are then run the command otherwise 
skip it..

Later..





More information about the fedora-list mailing list