Alternative for rm command

Ive been handling webserver with more than 1000 website and lots of unique visitors per month. Session are stored on the server hard drive and every end of the month i need to clean it up.

Now i was puzzled by rm command.
rm -f *

in /tmp/ directory. The terminal choked and gave out:

-bash: /bin/rm: Argument list too long

Apparently there are a maximum number of files that can be passed to rm.

ls -1 | grep sess | wc -l

382611

[ad#squere-ads]

wow 382611 session files! image how long it would take if you have an application that running with sessions.
The solution for this problem would be :

find . -name 'sess*' | xargs rm

Leave a comment

Your email address will not be published. Required fields are marked *