Print

Print


On Tue, 14 Aug 2007, ODEN,MARK THOMAS wrote:

> I have a daily cron job that tars and gzips hourly logs and places them in a 
> new directory (/ftp/oldtraces) and deletes logs older than 24 hours.  I was 
> running the backup script w/o the daily delete command to test that the 
> backups were going well and then enabled the delete command.  Unfortunately 
> the delete command deleted the entire /ftp/traces folder (including the 
> folder itself) which caused no more logs to be uploaded.  Can you help me fix 
> this line so it doesn't delete the folder?
>
> find /ftp/traces -cmin +1440 -print | xargs rm -rf

Adding -type f will probably solve it.  That way, find will only return 
files...not directories.

find /ftp/traces -cmin +1440 -type f -print | xargs rm -rf

I also wonder if you really want -cmin or if -mmin would be more 
appropriate?

----------------------------------------------------------------------
  Jon Lewis                   |  I route
  Senior Network Engineer     |  therefore you are
  Atlantic Net                |
_________ http://www.lewis.org/~jlewis/pgp for PGP public key_________