News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Recursive file extension renaming for large collections of files

Started by clem, December 29, 2019, 01:23:50 AM

Previous topic - Next topic

clem

This topic is pretty close to what I'd like to do ... but not quite.

https://exiftool.org/forum/index.php?topic=10491.0

I'd like to dive deep into a series of folders with many many files (all without extensions) and get exiftool to add the missing extensions to everything it can identify. Bonus to rename the files in YYY-MM-DD-HHMMSS.extension if it is an image or video file. [not all files are images or videos... some are hidden .tar files etc.]

so far I've been using iterations of

exiftool -ext '*' -if '$FileType=~/JPEG/i' '-Directory<./%f.$FileTypeExtension' -r DIR/
exiftool -ext '*' -if '$FileType=~/MOV/i' '-Directory<./%f.$FileTypeExtension' -r DIR/
exiftool -ext '*' -if '$FileType=~/HEIC/i' '-Directory<./%f.$FileTypeExtension' -r DIR/

but considering the variety of files I'm dealing with, that might be a bit tedious.

thank you!

StarGeek

In that topic the the poster was looking for jpegs in particular.  If you want exiftool to add extensions to anything it can identify, then just remove the -if statement.  Also take note that I messed up the first attempts and it should be Filename as listed in the last post in that thread.
exiftool -ext '*' '-FileName<%f.$FileTypeExtension' -r DIR/
* 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).

Phil Harvey

And here is your bonus command:

exiftool -ext '*' '-FileName<%f.$FileTypeExtension' '-FileName<${CreateDate;$self->GetValue("MIMEType")=~/image|video/ or undef $_}.$FileTypeExtension' -r -d %Y-%m-%d-%H%M%S%%-c DIR

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

clem

Thank you very much to both of you. :-) Now to let the 'pooter do the hard work of diving through all the files... :-)

thank you,