Generating a new filename that adds the original date to the beginning

Started by mpegleg, September 20, 2020, 08:44:53 PM

Previous topic - Next topic

mpegleg

Hi. Long time away from here, and unfortunately I've become very rusty with all the ExifTool syntax. :'(

I wish to add the DateTimeOriginal to the beginning of my old avi video Files (note: without using Config files). [Using Windows 10]
There's quite a lot of them, so I'd rather be able to batch rename them.

Eg).

Filename: MVI_4046.avi   (that has a Date/Time Original of 2007:02:01 13:05:21)

>>> I'd like the new Filename to be: 2007-02-01 13.05.21 MVI_4046.avi <<<

The following code almost does what I want, albeit without the addition of the original filename:
-FileName<${DateTimeOriginal} -d "%Y-%m-%d %H.%M.%S.%%e"

...which gives me: 2007-02-01 13.05.21.avi

I'm just not sure how to "easily" add on the original filename (ie. the MVI_4046). I've been experimenting with the $Filename variable in various places, but so far I've had no success.
OS: Windows 11 Pro

StarGeek

%f is replaced by the filename without the extension,
"-FileName<$DateTimeOriginal %f.%e" -d "%Y-%m-%d %H.%M.%S"
or
"-FileName<DateTimeOriginal" -d "%Y-%m-%d %H.%M.%S %f%.%%e"
should work, though I haven't tested these.

No need for braces unless the character following DateTimeOriginal is alpha-numeric or underscore (maybe some others, can't remember).  The second version doesn't need the dollar sign. 
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

mpegleg

Thanks StarGeek.

I couldn't get your second example to work. (I'm using them via ExifMixer).

However, your first example worked a treat!
OS: Windows 11 Pro

StarGeek

Oops, misplaced percent sign, goes in front of the f
"-FileName<DateTimeOriginal" -d "%Y-%m-%d %H.%M.%S %%f.%%e"
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

mpegleg

OS: Windows 11 Pro