How do I delete files when there are too many for bash?Category: Shell Tricks
Sometimes there are too many fils in a directory to be deleted by use of '*' because it expands larger than bash's ability to handle it.
There are several ways around this. You can use find with -exec to call "rm" but this forks an individual 'rm' process on each file.
One trick is to use xargs to clump 100 or so files per "rm" call and to run 5 "rm"s in parallel:
ls | xargs -P 5 -n 100 rm
|