Apple - How to backup/export photos/videos from the new Photos app to an external hard disk?

If you simply want the entire Masters structure copied to a new drive, then

  • first find your iPhoto or Photos Library file. Default location for both is ~/Pictures/

  • Right click the Library file & select Show Package Contents - that will expose the 'file' as the folder it really is.

  • The Masters folder should be just inside. You can copy that to anywhere.
    It is sorted into years, then months. Not all contained folders will actually be populated, if old photos were ever deleted, the file structure remains.

As pointed out in comments, if you need the copied structure to be readable natively on Windows, then you ought to format the target disk as ExFAT.
Windows cannot natively read Mac OS Extended disks & would need 3rd party support.


I know this is old and answered, but I think the script I put together after a day of googling and trying is worth sharing.

Modify your options, and this script either moves or copies your originals to a folder named 'yyyy-mm-dd Your Album Name'. So you keep track of your original album titles, and all photos are sorted by day as well.

Modify to suit your needs.. I do this to be able to have a shared file base of original photos synced by dropbox, and all sharing users can have their own copy of Photos.app use that as a base for referenced photos.

It attempts to avoid overwriting photos with the same name, by first verifying if a non-identical file exists at the same path already.

Also, it sets the timestamp of the newly made folders to the date of the events they have. Nice to sort events by date in finder or whatever, although the folder names already start with the date (because if you copy them elsewhere, timestamps may change anyway).

It is compatible with single quotes in album names. It may be compatible with quotation marks, but I have NOT tested that.

#!/bin/bash

#### A few options ####
#dryrun=1
dryrun=0

# Choose to duplicate (slow, space eating) or move (space saving, fast if on same drive).
#action=cp
action=mv

# set your paths
# origin:
libr="Photos Library.photoslibrary"
# destination:
destpath="MyProperlyOrganizedFotos"

# no idea why Apple chooses a funny date. Adjust to your time-zone needs
dateoffset=978307200
#### End of options ####


sqllib="${libr}"/Database/apdb/Library.apdb
s="sqlite3 ${sqllib}"
#${s} 'select fileName,imageDate,imagePath,projectUuid from RKMaster'

${s} 'select fileName,imageDate,imagePath,projectUuid from RKMaster' | sed 's,",thisisaquotationmark,g' | while read -r line; do
  echo $line
  name=`echo "$line" | awk 'BEGIN {FS="|"} {print $1}'`
  date=`echo "$line" | awk 'BEGIN {FS="|"} {print $2}'`
  path=`echo "$line" | awk 'BEGIN {FS="|"} {print $3}'`
  albumid=`echo "$line" | awk 'BEGIN {FS="|"} {print $4}'`
  albumname=`${s} "select name from RKFolder where uuid == '${albumid}'" | sed -e 's,/,:,g' -e 's,!,,g' -e 's,",thisisaquotationmark,g'`
  realdate=`date -r $(( ${dateoffset} + ${date} )) '+%Y-%m-%d' `
  touchdate=`date -r $(( ${dateoffset} + ${date} )) '+%Y%m%d1200' `

  # does this file still exist? or did we move it already?
  src=`echo ${libr}/Masters/${path} | sed 's/thisisaquotationmark/\\"/g'`
  if [ ! -f "${src}" ]; then
    continue
  fi

  # trim:
  newpath=`echo $realdate $albumname | sed 's/thisisaquotationmark/\\\\"/g'`
  if [ ! $dryrun -eq 1 ]; then
    expandednewpath=`echo ${newpath}`
    mkdir -p "${destpath}/${newpath}"
    touch -t ${touchdate} "${destpath}/${newpath}"
  fi
  target="${destpath}/${newpath}/${name}"
  index=0

  # add an integer index to a file if the name exists in this path already
  while [ -f "${target}" ] && ! cmp --silent "${target}" "${src}" ; do
    echo 'Avoiding overwrite: ' $index
    index=$(( $index + 1 ))
    target="${destpath}/${newpath}/${name} $index"
  done
  if [ $dryrun -eq 1 ]; then
    echo "Would do ${action} '${src}' '${target}' "
  else
    echo "${action} '${src}' '${target}' "
    ${action} "${src}" "${target}"
  fi
done

A few updates and additions:

  1. You won't find the Masters folder in Catalina and Big Sur. It is now called Originals.

  2. Copying the Masters or Originals folders isn't straightforward. Those folders contain a number of sub-folders and sub-sub-folders. And you'll export the original unedited versions of your photos i.e. you'll lose the edits.

  3. Photos to Disk has been demised. It was great until Mojave but broke on Catalina because of changes in Photos database structure. There's a new app in Mac App Store named Photos Takeout that works on High Sierra, Mojave and Catalina (Should, too, on Big Sur when it's released, according to their website).

  4. Your Masters or Originals folder may be empty if your settings upload originals to iCloud and remove them from the Mac. Download them to Mac Photos first before exporting.