Author Topic: file name change  (Read 1256 times)

moviejimmy

  • Newbie
  • *
  • Posts: 2
file name change
« 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!!!

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15346
    • ExifTool Home Page
Re: file name change
« Reply #1 on: February 21, 2017, 07:40:45 AM »
This thread discusses exactly what you want to do.

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

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

moviejimmy

  • Newbie
  • *
  • Posts: 2
Re: file name change
« Reply #2 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?

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1128
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
Re: file name change
« Reply #3 on: February 22, 2017, 04:18:31 AM »
No need to try to be smarter than ExifTool; the rename is only done once :)
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15346
    • ExifTool Home Page
Re: file name change
« Reply #4 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).