Script to Organize(jpegs) based on date taken into folders.

Hey,

I have very little experience with applescript. I was wonder how to organize photos (.jpegs) into folders based on that what date they were taken. I started hand organizing which took way too long. I was wondering if there was tutorial or if someone could help me out

Thanks,
-Tabha

Hi,

this is a droplet solution. Save the script as application bundle.
Drag your files onto the icon. The first time you will prompted to choose a base destination folder to save the images in.
To change the destination folder double click the icon.

If you want to keep the dragged files, set the property deleteOriginals to false

The files will be saved into the same folder structure as iPhoto uses: [basefolder]/YYYY/MM/DD/xyz.jpg


property baseFolder : missing value
property deleteOriginals : true

on run
	set baseFolder to choose folder with prompt "Choose base folder"
end run

on open theItems
	if baseFolder is missing value then set baseFolder to choose folder with prompt "Choose base folder"
	repeat with oneItem in theItems
		set {name:Nm, creation date:Cd, name extension:Ex} to (info for oneItem)
		if Ex is in {"jpg", "jpeg"} then
			tell Cd to set {yr, mn, dy} to {year, its month as integer, day}
			set destination to quoted form of (POSIX path of baseFolder & yr & "/" & addZero(mn) & "/" & addZero(dy) & "/" & Nm)
			do shell script "/usr/bin/ditto " & quoted form of POSIX path of oneItem & " " & destination
			if deleteOriginals then do shell script "/bin/rm -r " & quoted form of POSIX path of oneItem
		end if
	end repeat
end open

on addZero(v)
	return text -2 thru -1 of ("0" & v)
end addZero