Folder Structure inside Photos.app

Hi

I have a rather deep folder strucure in finder with photos in it. Is there a way to copy this strucure (without the photos) and put it into the Photos.app?

Any tip or hint is welcome

Regards
Lazybaer

Hi,

try this script, it asks for a base folder and creates the appropriate folder structure in Photos.app recursively


set baseFinderFolder to choose folder
tell application "Finder" to set baseFolderName to name of baseFinderFolder
tell application "Photos"
	set basePhotosFolder to make new folder
	set name of basePhotosFolder to baseFolderName
end tell

processFolders(baseFinderFolder, basePhotosFolder)

on processFolders(finderFolder, photoFolder)
	tell application "Finder" to set subFolders to folders of finderFolder
	if (count subFolders) > 0 then
		repeat with aFolder in subFolders
			set photoSubFolder to createPhotoFolder(name of aFolder, photoFolder)
			processFolders(aFolder, photoSubFolder)
		end repeat
	end if
end processFolders

on createPhotoFolder(folderName, parentPhotoFolder)
	tell application "Photos"
		set newPhotoFolder to make new folder at parentPhotoFolder
		set name of newPhotoFolder to folderName
		return newPhotoFolder
	end tell
end createPhotoFolder

Hi Stefan

Thanks a lot for your input. The proposed script works perfectly.

Despite this I have another question:

How can I address a folder or a subfolder in the Photos.app? It would be perfect if I could also copy pictures from the finder side to those folders ‘automatically’.

e.g. from the finder path:

Photos:Friends:2012:Charles

copy all photos of the folder Charles to the folder

Photos – Friends – 2012 – Charles

of the Photos.app

Hope you can help once more.

Thanks in advance and regards

Lazybaer

I’m not very familiar with Photos.app yet, but you can reference the folder structure like in the Finder.
container is the base class, album and folder are subclasses of container


tell application "Photos"
	container "Charles" of container "2012" of container "Friends"
end tell