Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A script to trash an iPhoto Album and its images Apps
Have you ever used iPhoto's built in "Burn" feature to backup or archive albums to CD or DVD? Then you tell yourself "Now that I have backed up my albums, I want to delete them from iPhoto to save space and make iPhoto snappier." Or, you want to delete an ablum and it's images because it already exists in another Photo Library through the use of apps like iPhoto Buddy.

PROBLEM: When you delete an album from iPhoto, it deletes the album only, the pictures still reside in your Photo Library, and therefore are still taking up space on your hard drive. You might think, "I'll just go to the photo Library and delete them from there." It's not that simple -- what if your album or albums consist of images that are scattered all throughout your Library? Finding every photo accurately would take time.

SOLUTION: I wrote a shell script to assist in the trashing of iPhoto albums (moves albums and images to the trash). Also, for those who use iPhoto Buddy (or similar librarian type app), I have written the script so that it asks you which Library you would like to delete the album from; you can also delete multiple albums at once.

INSTRUCTIONS: Simply download the iphoto-album-annihilator script. Unzip it (Safari may do this for you). Open the Terminal. Go to the location in which you unzipped it. For example:

cd ~/Desktop

Then run the script by typing:

./iphoto-album-annihilator

Follow the easy on-screen instructions. Don't worry, the script will not delete albums automatically; you get to choose which albums you would like to delete. You can also move this script to /usr/bin to have access to it at any time. Trust me, this script has made my life much much easier for my neighbor and I in the past couple of months (we were testing!), and it will make things much easier for you, too. Hopefully Apple will provide this functionality in future versions of iPhoto, just as they have already done for iTunes.

[robg adds: I haven't tested this script, but this is one of the most-often-asked questions I get via email, so I figured it was worth sharing one possible solution here.]

    •    
  • Currently 2.00 / 5
  You rated: 3 / 5 (4 votes cast)
 
[7,774 views]  

A script to trash an iPhoto Album and its images | 4 comments | Create New Account
Click here to return to the 'A script to trash an iPhoto Album and its images' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to trash an iPhoto Album and its images
Authored by: inblosam on Nov 16, '03 03:39:40PM
Hate to break it to you who spent so much time on that, but Apple has an applescript for doing the exact same thing, on their site even.
http://www.apple.com/applescript/iphoto/
I have used this and it works.

HOWEVER...what I (and I assume others) really need is something that will delete all the images from an album, but not any that belong to another album. In a few cases I have pictures of my son in his album but the same picture in another album for our whole family. Granted I would still have the picture after using this, but it would be nice for it not to delete the image from the other album too. Anyone know how to do this??!!!??

Let me know if and when you do!

[ Reply to This | # ]
here you go
Authored by: SOX on Nov 17, '03 01:10:38AM
I have not tested this. use it at your own risk! but maybe this will give you the idea

tell application "iPhoto"
	activate
	try
		set the album_list to the name of every album
		
		set this_ablum to (choose from list album_list with prompt "Pick the album to delete:") as string
		if this_ablum is "false" then error number -128
		display dialog "Are you sure you want to delete album "" & 
			this_ablum & "" and its contents?" & 
			return & return & 
			"This action cannot be undone." buttons {"Delete", "Stop"} default button 2 with icon 2
		if the button returned of the result is "Stop" then error number -128
		set the photo_count to the count of photos of album this_ablum
		if the photo_count is 0 then error "The chosen album contains no photos."
		
		set the ID_list to the id of every photo of every album
		with timeout of 1800 seconds
			
			
			repeat with i from the photo_count to 1 by -1
				
				set this_photo to photo i of this_album
				set this_ID to the id of this_photo --photo i
				set the add_flag to true
				repeat with q from 1 to the list_count
					set these_IDs to item q of the ID_list
					if these_IDs contains this_ID then
						set the add_flag to false
						exit repeat
					end if
				end repeat
				if the add_flag is true then
					add photo i of album this_ablum to trash album
				end if
			end repeat
			remove album this_ablum
		end timeout
		display dialog "The album "" & this_ablum & 
			"" has been deleted and its contents moved to the trash." & return & return & 
			"Choose "Empty Trash" from the iPhoto File menu to delete the images." buttons {"OK"} default button 1
	on error the error_message number the error_number
		if the error_number is not -128 then
			display dialog the error_message buttons {"Cancel"} default button 1
		end if
	end try
end tell
[\code]


[ Reply to This | # ]
I didn't know an AppleScript existed for this!?!?
Authored by: pwharff on Nov 18, '03 09:14:45PM

WOW, the AppleScript is cool. I tried to find something like this before I wrote this shell script and I couldn't find anything. There is one benefit in using my script however, you can delete multiple albums at once.



[ Reply to This | # ]
What about single photos?
Authored by: mitra on Aug 20, '04 06:01:54PM

Is there any way to trash individual photos, if you trash them from the album they are in, then they are still in the Library.

I realize that I could drag them to a seperate album, and then delete the contents of that album, but it must be possible to do this with a script directly from the album?

- Mitra



[ Reply to This | # ]