Adding file extensions with metadata

Started by galactichull, February 24, 2017, 10:25:26 AM

Previous topic - Next topic

galactichull

I'll attempt to be as clear as possible about my predicament.

Currently I have thousands of files with no extension.  They are named according to their hash.  Obviously with ExifTool I can generate a file that informs me of the extension.  That's helpful.

Is there a technique with ExifTool (or otherwise) to use the metadata to add in batch process the appropriate file extension to each file?  (I'd rather not do it one by one.)

Thank you for any help.

Phil Harvey

Things like this are easy:

exiftool "-filename<%f.$fileTypeExtension" DIR

And add -r to the command to recursively process subdirectories.

- 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 ($).

StarGeek

Doesn't this also need an -ext *?

And when did you slip fileTypeExtension into the mix.  I can't keep up!
* 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

Quote from: StarGeek on February 25, 2017, 04:35:10 AM
Doesn't this also need an -ext *?

Right.  Good point!

QuoteAnd when did you slip fileTypeExtension into the mix.  I can't keep up!

April 2015. :)  FileType was close, but not quite right for procedures like this.

- 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 ($).

galactichull

Excellent.  I'll give this a shot. Thank you!