how to easily import images into new

scripting Photos

So with 10.10.3 and Apple’s new Photos’s app, people have been asking how to easily import whole folder’s worth of images into it. Here’s a nice little AppleScript that’ll do it for you very easily. Just plonk the code into Script Editor and hit the run button. 🙂

Click the image below to get the code ꜜ Screen Shot 2015-04-15 at 20.08.31

Here’s the unformatted code that you can cut and paste into Script Editor, or get if from my pastebin here:

--import images from a folder into
-- by Applehelwriter 2015 -- requires Yosemite 10.10.3

set importFolder to choose folder

set extensionsList to {"jpg", "png", "tiff"}
tell application "Finder" to set theFiles to every file of importFolder whose name extension is in extensionsList

if (count of theFiles) < 1 then
display dialog "No images selected!" buttons "OK"
display dialog "Create a new album with name" default answer "Imports"
set albumName to text returned of the result
set timeNow to time string of (current date)
set today to date string of (current date)
set albumName to albumName & " " & timeNow & " " & today
set imageList to {} repeat with i from 1 to number of items in theFiles
set this_item to item i of theFiles as alias
set the end of imageList to this_item
end repeat

tell application "Photos"
delay 2
import imageList into (make new album named albumName) skip check duplicates yes
end tell

end if


About philastokes

Independent Software Developer, Technical Writer and Researcher at SentinelOne. Explaining the unexplainable with images, video and text. Scripting anything imaginable in AppleScript, Bash, Python and Swift.

Posted on April 15, 2015, in AppleScript, Yosemite and tagged , , . Bookmark the permalink. 3 Comments.

  1. Hello, thanks for your script. It works great. I recommend opening the Photos app first, because the 2 seconds delay is too short otherwise. Would it be possible to name the album with the name of the folder automatically ? I’m not an applescript programmer and I don’t know how to do that. Thanks.

  2. Awesome Script.

    Is there any way that we can enhance this script by which it can create Folders and Albums directly into the photos app by going through the tree structure of the selected folder and then import it into the photos app.

    Thanks in advanced.

  3. Really useful script, thanks! But I am trying to develop a workflow whereby I use Lightroom to manage all my photos, and export a subset (of good ones!) to Photos for syncing across devices. So is there anyway to identify a subset of photos in Lightroom (e.g. by tagging, or putting them into a smart folder) and running a script to import just those photos into Photos?

%d bloggers like this: