Using "find" in a script..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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..



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux