Skip to content

Instantly share code, notes, and snippets.

@itod
Last active April 8, 2022 14:55
Show Gist options
  • Save itod/4346789 to your computer and use it in GitHub Desktop.
Save itod/4346789 to your computer and use it in GitHub Desktop.
Recursively extract Original photos from an iPhoto library
set _srcPath to ((get path to desktop) & "Backup:Pictures" as string)
set _destPath to ((get path to desktop) & "Out" as string)
on processDir(_parent)
tell application "Finder"
set _parentName to (get name of _parent as string)
set _kids to (get every item of _parent whose name is not ".")
if "Thumbs" is equal to _parentName then
return
else if "Originals" is equal to _parentName then
repeat with _pic in _kids
--display dialog _pic as string
try
copy _pic to folder (my _destPath as string)
end try
end repeat
else
repeat with _kid in _kids
--display dialog (class of _kid as string)
if (get class of _kid as string) is equal to "folder" then
my processDir(_kid)
end if
end repeat
end if
end tell
end processDir
tell application "Finder"
set _dir to folder _srcPath
my processDir(_dir)
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment