How to use 'cp' as a simple but reliable backup tool

Feb 17, '10 07:30:01AM

Contributed by: zkarj

While looking for the perfect product to keep my photos safe, I discovered that sometimes simple is best. My requirements were simple: ensure that all my digital photos, stored on a locally attached USB drive, were duplicated to another drive attached to my AirPort Extreme. My photos are in RAW format (specifically DNG files) and will never change, so I only need to concern myself with new files.

I checked out numerous commercial and free products for backup, synchronizing and more, and nothing quite fit the bill. Whilst rsync could probably do the job, I couldn't get my head around the terminology to be sure I wasn't risking the original files. Then I discovered the solution. So mind-bogglingly simple, and no third-party software required. In Terminal, I run this command:

cp -npRv "/Volumes/LocalUSB/Photos/" "/Volumes/RemoteUSB/Photos/"
Yes, it is the standard Unix copy (cp) command with a few options: The n and R ensure that all new files are copied from the directory tree. Files already there are not re-copied. In short, a quick and efficient means of getting just the new photos copied over.

Comments (47)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20100212171620210