ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: brianroyce on September 17, 2014, 06:12:38 PM

Title: Mac Command Line
Post by: brianroyce on September 17, 2014, 06:12:38 PM
My goal is to organize my pictures into a tree like this /ROOTPATH/2014/2014-09/2014-09-17/YYYYMMDD_MODELL_####.EXT

where

YYYY is the Year of the Createdate field
MM is the month of the createdate field
DD is the Day of the createdate field
_MODELL_ is the Cameramodell if taken the pictures with
#### is the original picture number and
EXT is the original Extension of the file (eg. 'NEF' or 'JPG')

I found this post and on the forum https://exiftool.org/forum/index.php/topic,5144.msg24773/topicseen.html#msg24773 and was blown away that was exactly what I wanted to do -- however it seems on the mac the command is different and I am having trouble getting even the date to output right.

I really want a one liner so that I can run it from different directories on different macs and point it back to my new network drive.

I have been messing with this for a little bit now and really need some help... something like bellow would be prefect

exiftool options "save to folder path" "image folder to read in"

I guess the best question is -- Is this possible?
Title: Re: Mac Command Line
Post by: Phil Harvey on September 17, 2014, 06:55:43 PM
What is the path to your network drive?  I assume it will be something like "/Volumes/NETWORK_DRIVE_NAME".  If so, the command you want could be something like this:

exiftool -r -d "/Volumes/NETWORK_DRIVE_NAME/%Y/%Y-%m/%Y-%m-%d/%Y%m%d" -FileName<${createdate}_${model;}_%-4f%-c.%e" .

Then, before running the command first change to the desired directory (since the source directory in the command is ".").  And you can put this in a shell script or alias so you don't need to type it every time.

You could also put it in an AppleScript to make it drag-and-drop if you want, but this is more involved.

In this command I have filtered the Model name to remove a few bad characters (that's what the semicolon does), but you may want more filtering, or even a user-defined tag like in the other thread to do more complicated translations.

All of the extra "%" characters in the other thread are because he was running it from a Windows BAT file.

- Phil
Title: Re: Mac Command Line
Post by: brianroyce on September 17, 2014, 07:28:34 PM
I think the command is missing a " does it go in the second part?
Title: Re: Mac Command Line
Post by: brianroyce on September 17, 2014, 07:34:58 PM
I am very happy I figured out the quotes on the mac -- I am seeing a lot of warnings -- does this look ok? I am not sure it seems to have moved the files in the test folder around correctly.


Test brianroyce$ exiftool -r -d './%Y/%Y-%m/%Y-%m-%d/%Y%m%d' '-FileName<${createdate}_${model;}_%-4f%-c.%e' .
Warning: [minor] Adjusted MakerNotes base by 62 - ./2008_07_04/1.jpg
Warning: [minor] Adjusted MakerNotes base by 62 - ./2008_07_04/2.jpg
Warning: [minor] Adjusted MakerNotes base by 62 - ./2008_07_04/3.jpg
Warning: [minor] Adjusted MakerNotes base by 62 - ./2008_07_04/4.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 001.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 002.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 003.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 004.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 005.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 006.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 007.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 008.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 009.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 010.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 011.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 012.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 013.jpg
Warning: [minor] Adjusted MakerNotes base by 50 - ./2008_07_04/4th of July 014.jpg
Warning: [minor] Adjusted MakerNotes base by 62 - ./2008_07_04/5.jpg
Warning: [minor] Adjusted MakerNotes base by 62 - ./2008_07_04/6.jpg
Warning: [minor] Tag 'createdate' not defined - ./2008_07_04/IMG_5786.JPG
Warning: No writable tags set from ./2008_07_04/IMG_5786.JPG
Warning: [minor] Tag 'createdate' not defined - ./2008_07_04/IMG_5787.JPG
Warning: No writable tags set from ./2008_07_04/IMG_5787.JPG
Warning: [minor] Tag 'createdate' not defined - ./2008_07_04/IMG_5788.JPG
Warning: No writable tags set from ./2008_07_04/IMG_5788.JPG
Warning: [minor] Tag 'createdate' not defined - ./2008_07_04/l_c760a2d729f4f2cfc5f9c50b9cd50716.jpg
Warning: No writable tags set from ./2008_07_04/l_c760a2d729f4f2cfc5f9c50b9cd50716.jpg
    4 directories scanned
    4 directories created
   97 image files updated
    4 image files unchanged
Title: Re: Mac Command Line
Post by: Phil Harvey on September 17, 2014, 08:06:15 PM
The makernote errors are not significant, but the files won't be moved/renamed if CreateDate doesn't exist (which it didn't for 4 files).  The others should have been moved OK, except that the original file names don't end with 4 digits, so copying the last 4 characters to the new name may give funny results.

You're right.  I was missing a quote at the start of the -filename argument.

- Phil
Title: Re: Mac Command Line
Post by: brianroyce on September 17, 2014, 08:53:21 PM
This is the best program ever!

Thank you so much.