Main Menu

Renaming File

Started by Gnou3000, January 21, 2020, 09:45:21 AM

Previous topic - Next topic

Gnou3000

Hi everybody !

I try ExifTool to rename files.
I have file names img_2689.mov and i want ExifTool renaming in "Creation date - Hour - Original Name file - Model.extension"
I tried :
exiftool "-filename<createdate" -globaltimeshift "+0:0:0 2:0:0" \ -d %Y-%m-%d_%H-%M-%S.%%e *.*
exiftool "-filename<%f_${model;}.%e" *.*
which rename the file img_2689.mov in 2019-04-20_15-36-32_Iphone.MOV
that's OK but i want Original Name file and space insteed of underscore. How to do ?

Thank's for help  ;)

StarGeek

Some links for further reference
The -d (dateFormat) option details how to change the date format.  You can find the Common Date Format Codes on the "FileName and Directory tags" page.
The percent codes for filename (%f), extension (%e), etc can be found in the -w (textout) option.

I'm guessing that you're using the GlobalTimeShift option to address the fact that the CreateDate is in UTC (as per the standard) and you're in a +2:00 time zone.  If that's the case, then the -api QuickTimeUTC option is a better choice, as you don't need to try and figure out if a date uses Summer/Daylight savings or regular time.

In order to change the underscore to a space, you just need to change it in the format code following the -d.  But since the space now breaks up the date code, you need to put quotes around it.

Additionally, since you want to rename by date and model, it's better to move the Extension code (%e with doubled quotes because it's embedded in the date code) out of the date code.

Also, it's better to just use a dot . to represent the current directory than *.*, especially if you plan on recursing into subdirectories at some point (see Common Mistake #2).

So try this:
exiftool "-filename<$createdate %f ${model;}.%e" -api QuickTimeUTC  "-d %Y-%m-%d %H-%M-%S" .
* 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).

Gnou3000

Hi StarGeek
Thank's for your answer and tips !  :)

When I try
exiftool "-filename<$createdate %f ${model;}.%e" -api QuickTimeUTC  "-d %Y-%m-%d %H-%M-%S" IMG_2737.MOV

I have this answer
Warning: [minor] The ExtractEmbedded option may find more tags in the media data - IMG_2737.MOV
Warning: New file name not allowed in Windows (contains ':') - IMG_2737.MOV
    0 image files updated
    1 files weren't updated due to errors


And filename is not changed !  :'(
It's probably due to QuickTime UTC format which should be in YYYY:MM:DD HH:MM:SS format

StarGeek

Oops, sorry, my mistake.  I quoted the -d wrong.

exiftool "-filename<$createdate %f ${model;}.%e" -api QuickTimeUTC  -d "%Y-%m-%d %H-%M-%S" .
* 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).

Gnou3000

Don't be sorry
You saved my day !

That's perfect

Thank's so much !!