Feature, maybe misfeature

Denis Beauchemin Denis.Beauchemin at USHERBROOKE.CA
Mon Sep 16 21:10:20 IST 2002


On Mon, 2002-09-16 at 15:07, Julian Field wrote:
> 
> As no-one seems to have posted anything, how about a line like this which
> will delete all files under the current directory more than 14 days old:
>    find . -type f -mtime +14 -print | xargs rm -f

I'd recommend using:
    find . -type f -mtime +14 -print0 | xargs -0 rm -f

That way you won't get into trouble if a file name contains spaces or
some other strange character.  Find puts a null character at the end of
each file name and xargs expects null-separated arguments.

Denis
-- 
Denis Beauchemin, analyste
Université de Sherbrooke, S.T.I.
T: 819.821.8000x2252 F: 819.821.8045




More information about the MailScanner mailing list