[LUAU] How do you delete over 500,000 files in a directory

Tim Newsham newsham at lava.net
Thu Nov 3 16:06:13 PST 2005


>  find . -name 'mgetty*' -maxdepth 1 -print | xargs rm

Also beware of filenames with spaces when using xargs.  If you
know none of the files have spaces, then the above should work
fine for you.  If you aren't sure something like:

     find . -name '*mgetty*' -print0 |xargs -0 rm

will do what you want.  You might want to look at other find flags
as well (like -type f, for example).

You'd think that by 2005, arbitrary length command lines wouldn't
be an issue (assuming they could all fit in memory, or kmem, or some
suitable place).  I wonder if anyone has made a more up-to-date
unix like system that fixes these warbles..

Oh yah, plan9. ;-)

>    Clifton Royston  --  cliftonr at iandicomputing.com / cliftonr at lava.net

Tim Newsham
http://www.lava.net/~newsham/



More information about the LUAU mailing list