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


Click here to return to the 'A similar technique' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A similar technique
Authored by: pck on Jul 03, '02 01:25:50AM

Much of this goes back to basic (or at least standard) shell scripting.

The main problem with the as-submitted command is that identical instance
numbers in different dated-subdirectories will over-write each other.

A possible solution would be something like this (yes, there are more efficient
solutions):

	% sh    [or, as I prefer, zsh, this is to get to a familiar scripting syntax]
	% cd ; mkdir some-image-dir ; cd some-image-dir
	% path_to_iphoto_dir="../Pictures/iPhoto Library" ; find $path_to_iphoto_dir -name *.jpg | while read file ; do 
		new=`echo $file | sed -e "s,$path_to_iphoto_dir/,,;s,/,-,g"` ; echo cp "$new" . ; done
Remove the 'echo' before the 'cp' to actually execute the copy. I'll leave deciphering it to the typical "exercise for the interested reader".

[ Reply to This | # ]
A similar technique
Authored by: mr. applescript on Jul 03, '02 12:52:35PM

Those new to Mac OS X might not realize that the shell is not the only way to automate the computer. Try using AppleScript. For example, here's the script for moving all the JPEG images in an entire directory to another folder. The variables (this_folder and target_folder) contain refs to the cooresponding directories.

-- Sal

tell application "Finder"
move (every file of the entire contents of this_folder whose name extension is "jpg") to the target_folder
end tell



[ Reply to This | # ]
A similar technique
Authored by: kerim on Jul 03, '02 07:29:23PM

Does this applescript solution work recursively? The issue was that iPhoto stores its photos in many many subfolders. If everything were in the same folder one could simply drag and drop the whole folder. I'm sure this is possible in Applescript, but I found that the shell sped things up considerably. Just think about all the spinning color wheels you get when you try to select a lot of items in the finder and do something with them! All those Aqua tricks (transparnet dragging) really don't scale very well when you are doing operations on thousands of files. It would be interesting to compare the speed using Applescript and using the shell ...



[ Reply to This | # ]