.
Home > Bookmarks, Hosting, Linux > /bin/rm Argument list too long – Linux

/bin/rm Argument list too long – Linux

August 31st, 2008 Leave a comment Go to comments

When you are trying to delete too many files in a directory at the same time, it seems rm has limits (kernel limitation on the size of the parameters of the command).

Example of using find command to solve this problem:

find /home/mydir/ -name ‘*.ext’ -print0 | xargs -0 rm -f

where:

  • ext = file extension (can be * , all files )
  • -f, –force = ignore nonexistent files, never prompt
  • xargs = parameter to pass the delete command

WARNING: be careful with this command, you can erase wrong folder/files !!!

  1. No comments yet.
  1. No trackbacks yet.

GoCache - ByREV-Cache v1.0 - live served in : 0.394529 sec (gzip)