Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an extremely large directory (containing millions of files summing up to 150 GB) which I want to delete.

Is there a faster method than using rm -rf which takes ages to complete on this directory?

BTW: It's an AIX system and the directory resides on an NFS mount.

share|improve this question
  1. Rename (mv) the directory to some temporary name, re-create it with the same name, owner and permissions. This way any users/processes that use that directory can proceed in a matter of seconds. Delete the temporary directory later (or in the background).

  2. An alternative that requires changes on the side of the actual NFS server: prepare a separate empty filesystem that will hold your data and mount it over the directory. The directory will be empty from the client point of view. You can later delete files that are hidded below the mount point. The benefit here is substantial, because next time when you need to delete the same directory you can just overwrite the whole filesystem (mkfs), which takes minutes not hours. No need to rm -rf anything at all.

share|improve this answer

rm -rf is going to be as fast as you can get-unless you run the command on the NFS server itself. You may be able to see some speed up by running it from the remote machine. You could also do

rm -rf /path/ &

to put the job into the background so you can keep working.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.