Drop Folder/subfolders on Script.app and run.

Complete newbie here. I have somehow managed to create a script that will allow me to drop a number of JPG files onto it, resize them and resave them - leaving out the files that are already the appropriate size - and it actually works!

Only problem is I have over 15,000 images that need to be resized and resaved. The images are in many different subfolders and ideally i would like to drop the highest level folder onto the script and let it do its thing - maintaining the same folder structure. Is there a way to make that happen?

As of yet i can’t even just drop one single folder to make it work, i have to drop just files.

Thanks in advance!

Hi, and welcome to the forum.

This will get the alias of every file (including those in subfolders.) It’s not a droplet - I’d have to look into droplets for folders, I’m still pretty new to this myself and I don’t think I’ve tried that yet.

j


set theFolder to (choose folder)
tell application "Finder"
	set fileList to (files of entire contents of theFolder) as alias list
end tell

You can use this for a folder and subfolders of images, but it has no error checking. I didn’t have time to do more.


on open theItems
	
	tell application "Finder"
		
		repeat with thisItem in theItems
			if the kind of thisItem is "folder" then
				
				repeat with aFile in (files of entire contents of thisItem) as alias list
					
					-- your resize and resave script here

				end repeat
				
			end if
		end repeat
		
	end tell
	
end open