Created
April 28, 2020 02:35
-
-
Save gneek/41f96ceb2a41c128410471cec906cead to your computer and use it in GitHub Desktop.
Photo Importer for Apple Photos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Photos.app barfs if you try to import thousands of photos so this does it one by one.