Multiple Tags in the FileName

Started by BashedandConfused, June 15, 2017, 12:55:58 AM

Previous topic - Next topic

BashedandConfused

This is the example I am trying to modify:

exiftool '-FileName<CreateDate' -d %Y%m%d_%H%M%S%%-c.%%e dir

I would like to include the make and model tags along with the createdate tag in the FileName.

This is in a bash script that I am writing. I tried creating a user defined shortcut for it but I get a token error when I run it.

Here is what I have so far:

%Image::ExifTool::UserDefined::Shortcuts = (
        MyShortcut => ['exif:make','model','createdate'],
        MyAlias => "Final",
);

exiftool -r -d %Y/%m/%d/image_%H%M%S.%%e "-testname<Final" finalfiles/IMG_8099.JPG


Any help is greatly appreciated.

StarGeek

Quote from: BashedandConfused on June 15, 2017, 12:55:58 AM
I would like to include the make and model tags along with the createdate tag in the FileName.

Try something like
exiftool '-FileName<${CreateDate}_${exif:make;}_${Model;}' -d %Y%m%d_%H%M%S%%-c.%%e dir

I added a semicolon to the end of the make and model tags because that will try and make the tag safe for a filename (removes slashes, colons, question marks, etc).

Quote
%Image::ExifTool::UserDefined::Shortcuts = (
        MyShortcut => ['exif:make','model','createdate'],
        MyAlias => "Final",
);

exiftool -r -d %Y/%m/%d/image_%H%M%S.%%e "-testname<Final" finalfiles/IMG_8099.JPG


You're making a shortcut tag called MyAlias for the tag Final, but there isn't a tag called Final (afaik).  You would want Final to be
[code]%Image::ExifTool::UserDefined::Shortcuts = (
        Final=> ['exif:make','model','createdate'],
);


But using the Final tag as you plan, each tag in the shortcut will be separated by a CommaSpace ", " or if you use the -sep option, whatever you designate as the separator. 

Example output:
C:\>exiftool -myshortcut X:\!temp\Test3.jpg
Make                            : EXIF:Make
Camera Model Name               : EXIF:Model
Create Date                     : 2002:02:02 02:02:02

C:\>exiftool "-testname<${MyShortcut;}" -d %Y%m%d_%H%M%S%%-c.%%e X:\!temp\Test3.jpg
'X:/!temp/Test3.jpg' --> 'X:/!temp/EXIFMake, EXIFModel, 20020202_020202.jpg'
    0 image files updated
    1 image files unchanged

C:\>exiftool "-testname<${MyShortcut;}" -sep - -d %Y%m%d_%H%M%S%%-c.%%e X:\!temp\Test3.jpg
'X:/!temp/Test3.jpg' --> 'X:/!temp/EXIFMake-EXIFModel-20020202_020202.jpg'
    0 image files updated
    1 image files unchanged
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).