Independant Computer Consultant

Software Consulting, Development, Strategy, and Programming
Home >  Problem: rm: Argument list too long

Problem: rm: Argument list too long

6084 hits
      Sometimes, when a directory contains a lot of files, running rm will have problem,
      rm: Argument list too long
      In this case, use find command and pipe can help to remove these huge files. Here is the steps:
      **** IMPORTANCE ****
      Make sure that you are the directory where you are going to remove the files under it. Use the following method will remove all the files in the current working directory. Be careful and be sure to know what you are doing.
      1) Change to the directory where you will remove the files under it
      2) Double check the location with pwd:
       prompt> pwd
      3) Make sure the directory is the directory with files you are going to remove
      4) Then do this:
       prompt> find -name "*" |xargs rm
      you can use wildcard like "junk*" etc remove all file begin with junk
      5) It may take a while, so be patient when you doing it.
      6) Use can also open another shell to check if the space is cleaning up or not, by using df command:
       prompt> df -k
      you will see the available space is increasing when you send a few df command.

[02/24/2010, 02:32]


CSLand.Com © 1996-2009. All Rights Reserved