Possibly speed copies via Terminal
Jun 05, '07 07:30:00AM
Contributed by: punka
I was in a hurry trying to back up my iPhoto Library to an external Firewire 400 drive, and was disappointed to see that the Finder was going to take almost an hour to back up all 11GB of pictures I had. I went into Activity Monitor to see just how slowly the Finder was going, and found it was copying at 8MB/sec, with the Finder taking 60% of my PowerBook G4's CPU. So I canceled the copy, opened up Terminal.app, and executed the following command:
cp -r ~/Pictures/iPhoto Library/ /Volumes/myexternaldrive/
Activity Monitor showed cp using only 20% CPU, and maxing out my drives at 23MB/sec! What would have taken an eternity in the Finder took only 15 minutes, thanks to Terminal.
NOTE: If you need to copy files with resource forks, install the Developer Tools and use CpMac (in /Developer » Tools) instead of cp.
[robg adds: On a faster machine, I'm not sure there will be much difference in the speed -- I did a quick test on the Mac Pro (using a 3.22GB folder with a few thousand files spread through 160 folders), and both methods took about the same amount of time. In addition to the resource fork issue, note that cp won't copy OS X alias files; it just throws an error message during the copy.
ditto (included with OS X), however, seems to copy them just fine, and handles resource forks automatically. So I tested again with ditto instead of cp. Whereas the time gap with cp wasn't really measurable, ditto was about 15 seconds quicker than the Finder on my 3.2GB test copy. So if I were copying a huge folder, I'd probably try ditto, as it could save a few minutes of copying time.]
Comments (15)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20070528222745661