You know what happens when you never empty your trash? You wind up with 211,000 email messages in your trash folder and your mail server freaks out. (Most of the 211,000 are, of course, trashed spam.)
If you have too much mail in your folder, you run into the following:
$ rm * -bash: /bin/rm: Argument list too long
The solution is to use find
like this:
$find . -type f | xargs rm
Of course, find
is recursive, so be careful if you have any subdirectories in that directory.
December 15, 2006 at 11:24 am
Put -maxdepth 1 after “-type f” and it will not recurse
Thanks for writing this down, I nomrally have to “rediscover” this every few months.
December 16, 2006 at 3:22 am
Why not:
ls | xargs rm
Although it doesn’t include hidden files, and using ‘ls -a’ is dangerous since it will list ‘..’.
December 20, 2006 at 1:27 pm
Why not rm -r subdir?