Just as a follow up—it was kinda driving me nuts that I was just tossing away sidecar files, as per my above post, so I've written the following AppleScript (below) which, which I first run on the files, before Hazel touches them. Basically, it does the following:
STEP 1: Sorts all PHOTO files (and associated SIDECAR files, if applicable) into a PHOTOS folder.
STEP 2: Sorts all VIDEO files (and associated SIDECAR files, if applicable) into a VIDEOS folder.
STEP 3: Sorts all OTHER files (not captured by steps 1 or 2) into an OTHERS folder.
I then have Hazel rules attached to the individual PHOTOS and VIDEOS folder, at which point it then continues with my Hazel-based workflows. I manually deal with the files in the OTHERS folder (this is just a safety net, incase there's a random photo extension I've missed, etc.).
This still isn't perfect—it doesn't solve the renaming issue, and there are issues with Hazel sorting the media files and sidecar files into subfolders based on creation date (as you could create the sidecar on a different date than the photo/video was taken, etc.), but at least, with running this script first, I'm not throwing anything away.
Below is the AppleScript to do the sorting. You can't use it as a Folder Action, but you can use it (via Automator) to create an Image Capture plugin (which you can then use when importing from your iPhone) or a stand-alone Application (droplet). Figure I'd post it here for anyone else who's run into this issue...
Thanks,
Kristin.
- Code: Select all
on run {input, parameters}
-- SET FILE EXTENSIONS
-- PHOTO file extensions:
set photoExtensionList to {"jpg","png","gif","raw","tif"}
-- VIDEO file extensions:
set videoExtensionList to {"mov","m4v"}
-- SIDECAR file extensions:
set sidecarExtensionList to {"aae"}
-- SET FOLDER LOCATIONS
-- move PHOTO (and SIDECAR, if available) files to this folder:
set photoDestinationFolder to alias "LOCATION:WHERE:YOU:WANT:PHOTO:FILES:MOVED:TO"
-- move VIDEO (and SIDECAR, if available) files to this folder:
set videoDestinationFolder to alias "LOCATION:WHERE:YOU:WANT:VIDEO:FILES:MOVED:TO"
-- move all OTHER files to this folder:
set otherDestinationFolder to alias "LOCATION:WHERE:YOU:WANT:ALL:OTHER:FILES:MOVED:TO"
tell application "Finder"
set thePhotoMoveList to {}
set theVideoMoveList to {}
set theOtherMoveList to {}
set photoMoveList to a reference to thePhotoMoveList
set videoMoveList to a reference to theVideoMoveList
set otherMoveList to a reference to theOtherMoveList
-- populate lists of files to move
repeat with the_item in input
set the_item to (the_item as alias)
if name extension of the_item is in photoExtensionList then
copy the_item to the end of photoMoveList
set parent_folder to (container of the_item) as alias as text
set item_name to text 1 thru ((length of (the_item's name as text)) - (length of (the_item's name extension as text))) of (the_item's name as text)
repeat with ext in sidecarExtensionList
try
copy ((parent_folder & item_name & ext) as alias) to the end of photoMoveList
end try
end repeat
else if name extension of the_item is in videoExtensionList then
copy the_item to the end of videoMoveList
set parent_folder to (container of the_item) as alias as text
set item_name to text 1 thru ((length of (the_item's name as text)) - (length of (the_item's name extension as text))) of (the_item's name as text)
repeat with ext in sidecarExtensionList
try
copy ((parent_folder & item_name & ext) as alias) to the end of videoMoveList
end try
end repeat
else if (name extension of the_item is not in videoExtensionList) and (name extension of the_item is not in sidecarExtensionList) and (name extension of the_item is not in sidecarExtensionList) then
copy the_item to the end of otherMoveList
set parent_folder to (container of the_item) as alias as text
set item_name to text 1 thru ((length of (the_item's name as text)) - (length of (the_item's name extension as text))) of (the_item's name as text)
end if
end repeat
-- MOVE FILES
-- move PHOTO (and SIDECAR, if available) files
move thePhotoMoveList to photoDestinationFolder without replacing
-- move VIDEO (and SIDECAR, if available) files
move theVideoMoveList to videoDestinationFolder without replacing
-- move all OTHER files
move theOtherMoveList to otherDestinationFolder without replacing
end tell
end run