ExifTool Forum

ExifTool => Newbies => Topic started by: mpegleg on September 20, 2020, 08:44:53 PM

Title: Generating a new filename that adds the original date to the beginning
Post by: mpegleg on September 20, 2020, 08:44:53 PM
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.
Title: Re: Generating a new filename that adds the original date to the beginning
Post by: StarGeek on September 20, 2020, 09:54:21 PM
%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. 
Title: Re: Generating a new filename that adds the original date to the beginning
Post by: mpegleg on September 20, 2020, 10:04:03 PM
Thanks StarGeek.

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

However, your first example worked a treat!
Title: Re: Generating a new filename that adds the original date to the beginning
Post by: StarGeek on September 20, 2020, 10:52:33 PM
Oops, misplaced percent sign, goes in front of the f
"-FileName<DateTimeOriginal" -d "%Y-%m-%d %H.%M.%S %%f.%%e"
Title: Re: Generating a new filename that adds the original date to the beginning
Post by: mpegleg on September 20, 2020, 11:10:48 PM
Yep. That fixed it. Thanks again. :)