All posts for the day June 6th, 2018

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: •n – Do not overwrite an existing file
•p – Preserves attributes, including resource forks
•R – When the source file is a directory and the path ends in with a slash (/) then the entire contents of the directory are copied recursively
•v – Causes files to be listed when copied
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.

cp -Rpnv “/Volumes/Media-BU/iTunes Media” /Volumes/MediaBackup

cp -npRv /Volumes/Photographs/Photographs /Volumes/PhotoBackup