Phine Solutions web work notes

Use “rm” to delete files, a lot of files

Filed under: linux goodies — 1.618 @ 7:49 am

The other day when I use Xenu to check the broken links the /tmp directory was quickly filled up. When I tried to remove the temporary files using “rm *” command I was told “bach:/bin/rm Argument list too long”. Apparently there is a max number of files that rm can handle.

A little bit search on the web yielded this following solution:

use the find command and xargs, the file can be removed one by one. Like this in my case:

find . -name ‘sess_*’ | xargs rm

Since find command can also look for files with certain age, it is a great way to clean up files in this way.

1 Comment »

  1. Thx dude, it worked very well.

    One fine point though, when using any flavour of linux, the user may have to retype the apostrophes, because the terminal is getting some other type of apostrophe, not the inverted or usual one…

    Comment by Bono — August 10, 2009 @ 4:39 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

©phinesolutions.com