Am Mittwoch, 18. Juli 2007 schrieb Kyle Wheeler:
Another one I use often is: find ./tmp ./cur -type f -exec rm {} \;
Current GNU finds understand the -delete action:
find ./tmp ./cur -type f -delete
That should be as fast as the "ls" solution without getting you in trouble if a \r manages to get into one of the filenames somehow.
Another safe and fast solution would be
find ./tmp ./cur -type f -print0 | xargs -0 rm
which should also work with older GNU finds. I do not know which one is better supported (if at all) in finds from other vendors.
In any case both should be much faster than spawning an "rm" for every file, although this solution should also be safe. I would not trust the piped "ls-output-solution" (given in the grandparent) on a production system, however.
Greetings,
Gunter