Skip to content

Instantly share code, notes, and snippets.

@alexec
Created January 31, 2016 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexec/2d31c6550fa20f5241e8 to your computer and use it in GitHub Desktop.
Save alexec/2d31c6550fa20f5241e8 to your computer and use it in GitHub Desktop.
#! /bin/bash
set -eu
find "/Volumes/My Passport/Backups.backupdb/Alex Collins’s MacBook/2013-06-04-230142/Macintosh HD/Users/Shared/Pictures" -maxdepth 11 -path '*/Pictures/*' -type f \( -name '*.jpg' -or -name '*.JPG' -or -name '*.mov' -or -name '*.mov' \) | while read F ; do
D=$(stat -f '%Sm' -t '%Y/%m/%d' "$F")
if [ ! -e $D ]; then
echo "creating $D"
mkdir -p $D
fi
T="$D/$(basename "$F")"
if [ ! -e "$T" ]; then
echo "$F -> $T"
cp -vnp "$F" "$T"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment