By searching the forums here and the ExifTool forum I now have Hazel renaming my photo files as I desire with this ExifTool command, and it seems to work well when I manually copy files from my Camera Uploads directory into the proper destination directories (organized by Person/Event/Activity) in my main digital photos directory:
- Code: Select all
exiftool -P -d '%Y-%m-%d ' '-filename<${directory;s(.*/)()} ${FileModifyDate;} %.3c.%le' '-filename<${directory;s(.*/)()} ${GPSDateTime;} %.3c.%le' '-filename<${directory;s(.*/)()} ${MediaCreateDate;} %.3c.%le' '-filename<${directory;s(.*/)()} ${ModifyDate;} %.3c.%le' '-filename<${directory;s(.*/)()} ${DateTimeOriginal;} %.3c.%le' "$1"
In addition to renaming the files, I'd also like to copy each file's parent directory name into the file's Description tag so that I can sort on the Description in the Photos app. I can do this manually by running this ExifTool command (with the proper file path added) from Terminal:
- Code: Select all
'-imagedescription<${directory;s(.*/)()}'
When I do this, however, ExifTool makes a backup of copy of the original file which must be deleted, but that's no issue in itself. But when I try to combine the addition of the description with the renaming, I run into the problem:
- Code: Select all
exiftool -P '-imagedescription<${directory;s(.*/)()}' -d '%Y-%m-%d ' '-filename<${directory;s(.*/)()} ${FileModifyDate;} %.3c.%le' '-filename<${directory;s(.*/)()} ${GPSDateTime;} %.3c.%le' '-filename<${directory;s(.*/)()} ${MediaCreateDate;} %.3c.%le' '-filename<${directory;s(.*/)()} ${ModifyDate;} %.3c.%le' '-filename<${directory;s(.*/)()} ${DateTimeOriginal;} %.3c.%le' "$1"
The process actually works, but since the writing of the directory name into the Description creates a backup file, that appears to cause Hazel to activate the folder rules again, creating an endless loop with multiple copies of the file being spawned.
I've tried the ExifTool -overwrite_original switch, but it doesn't actually suppress the creation of the backup file and doesn't stop the loop when added to my renaming code. I've also tried separating the renaming and description addition into two sequential shell scripts in the same Haze rule, but that doesn't help either.
I'd sure appreciate some pointers in how to get the renaming and the adding of the description to play well together. Surely my failure to do so is due to a lack of understanding of both Hazel and ExifTool, but hopefully I've given enough information here for someone with more knowledge to nudge me in the right direction. Just what I've done so far will greatly reduce my manual efforts, but adding this one tweak would sure be nice. Then I can move on to videos--with probably more questions here.

Thanks!!