Super User is a question and answer site for computer enthusiasts and power users. 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

Can anyone help me diagnose why removing a directory would be so slow on my Mac?

$ du -hs mydir/
606M    mydir/
$ find mydir/ -type f -print | wc -l
   12720
$ date
Tue Sep 10 10:59:27 PDT 2013
$ rm -Rf mydir
$ date
Tue Sep 10 11:01:44 PDT 2013

This is my local machine, which is a pretty beefy Mac Pro with OS X 10.8. The directory has a lot of files and is pretty big, but over two minutes to delete it? Would this be expected?

Is there anyway I can figure out what, if anything, is making this process slow?

Thanks in advance!

share|improve this question
    
A lot of files to delete and the bottleneck is the harddrive. – justbrowsing Sep 10 '13 at 19:23
    
If you need to create and delete a lot of small files often, I'd suggest either a SSD or if you have sufficient RAM, storing the files in a ramdisk. – justbrowsing Sep 10 '13 at 19:25
    
Besides storage type, speed may also depend on filesystem. What filesystem type is the area with the files? bfs or local? a journaling filesystem has more overhead for deletions. – Rich Homolka Jul 3 '14 at 22:05

No matter what OS you are running, from Windows to OSX (Darwin / Unix) to Linux, and no matter the speed of your HDD or SSD, there is always the possibility for a bottleneck on file manipulations.

If the directory is very large, it is entirely possible to take over a full minute (or two!) to delete the directory.

If the directory (or any files, and possible sym-links) are stored on the network, this can cause a massive slowdown during basic file manipulation.

Furthermore, as you are aware, each device will take a different amount of time to delete files, etc. based on it's hardware and software specifications.

How big was this directory you were deleting? If you do not remember, keep a close watch for future file manipulation lags, as this can be a sign of a failing hard drive. The occasional lag is understandable, however. You may want to run a hard drive diagnostic to check for bad sectors on the drive, or on a Mac, verify (and repair) any permissions issues, via Disk Utility.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .