How to add missing file extensions for multiple files using ExifTool in Windows

1

I lost only the file extensions at the end of the file names for a few thousand .docx and .pdf files. So how do I attach them in one batch at the end of the existing FileName using ExifTool ?

Note 1. The file are in no way altered, only the file extension is lost. I can see which FileType the files are by drag and drop files one by one over ExifTool.exe, but it simply takes to long.

Note 2. I'm using Windows, so I need the Windows version of it.

Thank you

adobh

Posted 2016-10-06T14:54:18.443

Reputation: 13

Answers

2

Edit: Brian Murphy's answer is the better answer for this question. It requires at least Exiftool ver 9.93. For Windows CMD, change the single quotes to double quotes (PowerShell can use it as is).


Try this. Replace DIR with the target directory:
exiftool "-filename<$filename.$filetype" -r -ext "*" DIR

-filename The target "tag" to be copied to, in this case it will change the name of the file.

< Indicates that a tag is being copied.

$FileName.$FileType The filename is recreated taking the current filename $FileName, adding a dot ., and then taking what Exiftool believes to be the filetype $FileType and copying all that to the target tag as mentioned above.

-r recurse into subdirectories, can be removed if not needed.

-ext "*" Normally, Exiftool won't read files without an extension, since they aren't considered supported file types. This will override that.

StarGeek

Posted 2016-10-06T14:54:18.443

Reputation: 782

Thank you, that is exactly what I was looking for. Once again, thank you, you saved my day ;-) – adobh – 2016-10-07T23:05:57.460

3

For Windows, the command line to append file extensions where they do not exist (using free downloadable utility ExifTool):

exiftool -r '-filename<$filename.$filetypeextension' -ext . <yourdir>

-r optional switch for operating recursively into all subdirectories

'-filename<$filename.$filetypeextension' copies existing file_name & "." & file_type_extension from exif metadata and updates the filename

-ext . perform only on files with no extension

<yourdir> replace with your directory name

Brian Murphy

Posted 2016-10-06T14:54:18.443

Reputation: 31