rc3.org

Strong opinions, weakly held

Too much mail

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.

3 Comments

  1. 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.

  2. Why not:

    ls | xargs rm

    Although it doesn’t include hidden files, and using ‘ls -a’ is dangerous since it will list ‘..’.

  3. Why not rm -r subdir?

Leave a Reply

Your email address will not be published.

*

© 2016 rc3.org

Theme by Anders NorenUp ↑