ExifTool Forum

ExifTool => Newbies => Topic started by: moviejimmy on February 21, 2017, 05:06:32 AM

Title: file name change
Post by: moviejimmy on February 21, 2017, 05:06:32 AM
I came across this:

http://www.exiftool.org/index.html#filename
exiftool "-FileName<CreateDate" -d "%Y%m%d_%H%M%S.%%e" DIR

using CreateDate to change the file name.

What if I wanted to use CreateDate, Make, CameraModelName for the file name?

Looks something like:

DCI00567.jpg to 20170221-135602-Sony-NEX-6N.jpg

Thank you very much!!!
Title: Re: file name change
Post by: Phil Harvey on February 21, 2017, 07:40:45 AM
This thread (https://exiftool.org/forum/index.php/topic,5079.0.html) discusses exactly what you want to do.

I recommend the semicolon after Make and Model to remove illegal characters from the file name.

- Phil
Title: Re: file name change
Post by: moviejimmy on February 22, 2017, 04:06:57 AM
Thanks Phil! Exactly what I needed.

I tried this:

exiftool -P -d '%Y-%m-%d %H.%M.%S' \
    '-filename<${DateTimeOriginal}_${Make;}.%e' \
    '-filename<${CreateDate}_${Make;}_${Model;}.%e' \
    '-filename<${DateTimeOriginal}_${Make;}_${Model;}.%e' \
    $@

Is it correct that if all tags are available a file will get renamed three times?

I need to run this on about 20,000+ files. Is there a way I can speed things up a bit? e.g. by using -if? so that if DateTimeOriginal, Make and Model are all available, only the last line will be executed and the file will only get renamed once?
Title: Re: file name change
Post by: Hayo Baan on February 22, 2017, 04:18:31 AM
No need to try to be smarter than ExifTool; the rename is only done once :)
Title: Re: file name change
Post by: Phil Harvey on February 22, 2017, 07:23:44 AM
As Hayo said.

The last valid assignment takes precedence.  (eg. if DateTimeOriginal, Make and Model exist, then the first two assignments are ignored.)

- Phil