Deleting a Directory Full of Files

Published: 2007-10-03

I recently had a problem with 'rm ./*' returning the error '/bin/rm: Argument list too long'. The problem had previously popped up when removing the contents of a large cache directory and again when deleting a large mail spool. The work around is to pipe a find command into a rm. The following command will empty the directory you are in of all .jpgs.

find . -name '*.jpg' | xargs rm

More from this section

RECENT ARTICLES

Lightweight blog created on Ruby/GAA/Datastore stack

Put this together a month or two back but never got around to replaci... read more

Using Node JS and Couch DB Stack for Web Dev

With the recent hype surrounding Node.js I thought I'd better get my ... read more

Campaign Monitor API Using PHP and SOAP

Campaign Monitor has a fairly comprehensive API and support docs.&nbs... read more

Google Maps Snippet

Absolute bare basics when it comes the Google Map api but a snippet o... read more

CREDITS

powered by php-wax the php framework