Filename Creation Problems

Started by JohniKim, August 27, 2017, 09:18:38 PM

Previous topic - Next topic

JohniKim

Having problems with the extension getting mangled when renaming files.  Expected output would be in the format {YYYYMMDD}_{HMS}_{model}_{ImageNumber}.{Extension}.  So for example I would expect to receive a filename such as:

  20160402_211009_Canon EOS REBEL T3_6873

Instead, when using the syntax:

    exiftool -d "%%Y%%m%%d_%%H%%M%%S" "-filename<${DateTimeOriginal}_${model;}_%%%%-4f.%%%%e" .

I get the following results like this:


    ....
    20160402_210859_Canon EOS REBEL T3_%6872.48R2
    20160402_211009_Canon EOS REBEL T3_%6873.49R2


The filename is mostly correct, including the image numbers, but still has these problems:
  []  % sign in the file name
  []  Extension is changed (no longer CR2)

I have tried several variations of the command line, but they offer worse results:

I have also tried:
    exiftool -d "%%Y%%m%%d_%%H%%M%%S" "-filename<${DateTimeOriginal}_${model;}_%%-4f.%%e" .
    exiftool -d "%%Y%%m%%d_%%H%%M%%S" "-filename<${DateTimeOriginal}_${model;}_%%%%-4f.%%%e" .

It is almost as if the -c options is being used implicitly.

StarGeek

I'm assuming a windows bat file due to the doubled percent signs.

You're doing an extra doubling of the percent signs for the %-4f and %e.  From the docs on renaming (emphasis mine):
"Note that if used within a date format string, an extra '%' must be added to pass these codes through the date/time parser."

Since the %-4f and %e are not part of the date format string, they don't need to be doubled a second time.

Try this in your bat file:
exiftool -d "%%Y%%m%%d_%%H%%M%%S" "-filename<${DateTimeOriginal}_${model;}_%%-4f.%%e" .

or to test on the command line using TestName:
exiftool -d "%Y%m%d_%H%M%S" "-testname<${DateTimeOriginal}_${model;}_%-4f.%e" .
* 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).

JohniKim

@StarGeek, yep that was the ticket.  Sorry about not mentioning the batch file, but you guessed it correctly.

I was sort of on the right path with my other variations, but I never took it all the way down to just one percent sign.  Just started using ExifTool in lieu of Lightroom and I am loving it for it its speed and versatility handling files.  Now I can do all my initial file handling using ExifTool before cataloguing in LR. 

I had to look into other options because LR has a problem finding tags correctly in files I get from an iPad Pro (variety of MOV and JPEG files).  It would tag with incorrect times or just not import at all (MOV iles).

StarGeek

Quote from: JohniKim on August 27, 2017, 10:24:33 PMIt would tag with incorrect times or just not import at all (MOV iles).

One thing to watch for is if the difference in time is the same as the time zone difference.  Certain timestamps in MOV files are supposed to be saved as UTC time, but some cameras save it incorrectly as local time.
* 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).