Skip to content

Instantly share code, notes, and snippets.

@gneek
Created April 28, 2020 02:35
Show Gist options
  • Save gneek/41f96ceb2a41c128410471cec906cead to your computer and use it in GitHub Desktop.
Save gneek/41f96ceb2a41c128410471cec906cead to your computer and use it in GitHub Desktop.
Photo Importer for Apple Photos
tell application "Finder"
with timeout of 36000 seconds
set source_folder to choose folder with prompt "Select source folder."
set destination_folder to choose folder with prompt "Select folder to move imported images to"
my moveToPhotos(source_folder, destination_folder)
end timeout
end tell
on moveToPhotos(sFolder, dFolder)
set albumName to "2020"
set extensionsToInclude to {"jpg", "mov", "png"}
tell application "Finder" to set the_items to every file of sFolder
repeat with i from 1 to number of items in the the_items
set imageList to {}
set the_item to item i of the the_items as alias
set the end of imageList to the_item
tell application "Photos"
activate
set myAlbum to album named albumName
import imageList into myAlbum skip check duplicates no
end tell
tell application "Finder" to move the_item to folder dFolder
end repeat
say "All Done"
end moveToPhotos
@gneek
Copy link
Author

gneek commented Apr 28, 2020

Photos.app barfs if you try to import thousands of photos so this does it one by one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment