Marco Marongiu <[EMAIL PROTECTED]> writes:

> Dominic Mitchell wrote:
> > 
> > Marco Marongiu <[EMAIL PROTECTED]> writes:
> > > # You may prefer -mtime instead of -ctime here...
> > > find $CACHEDIR -type f -ctime +$MAXAGE -exec rm -f {} \;
> > 
> > This will go much quicker as:
> > 
> >   find $CACHEDIR -type f -ctime +$MAXAGE -print0 | xargs -0 rm -f
> > 
> > That will only run one rm process for every few thousand files.  Also,
> > it uses the "-0" options on both sides for safety.
> 
> Ok, but it may fail if the resulting command line is too long (and it
> may well be far too long, since cache files have veryverylongfilenames
> :-) That's why I prefer to execute rm in find instead of by mean of
> xargs.

No, it won't.  That's why xargs exists.  It knows the limit on each
system its built for, so you don't have to.

-Dom

-- 
| Semantico: creators of major online resources          |
|       URL: http://www.semantico.com/                   |
|       Tel: +44 (1273) 722222                           |
|   Address: 33 Bond St., Brighton, Sussex, BN1 1RD, UK. |

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to