[plug] rm of contents

Trevor Phillips T.Phillips at murdoch.edu.au
Mon Mar 17 11:37:23 WST 2003


On Sunday 16 March 2003 20:00, Cameron Patrick wrote:
> On Sun, Mar 16, 2003 at 07:46:03PM +0800, Leon Brooks wrote:
> | > find dir -type f -print0 | xargs -0 rm
> |
> | find dir -type f -exec rm -f {} \;
>
> Same thing, different meaning :P

Actually, from my experience, they're quite different.

The first will fail if it finds lots of files, as the command line will be too 
long.

The second will take more system resources, as it runs rm once for each file, 
instead of running it once for all files.

Even in flat directories, find is useful for handling vast quantities of 
files, by handling them one at a time. ^_^

-- 
. Trevor Phillips             -           http://jurai.murdoch.edu.au/ . 
: Web Technical Administrator     -          T.Phillips at murdoch.edu.au : 
| IT Services                        -              Murdoch University | 
 >--------------------------------------------------------------------<
| On nights such as this, evil deeds are done. And good deeds, of     /
| course. But mostly evil, on the whole.                             /
 \      -- (Terry Pratchett, Wyrd Sisters)                          /



More information about the plug mailing list