2

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

3

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.

1
  • Thank you, that is exactly what I was looking for. Once again, thank you, you saved my day ;-)
    – adobh
    Oct 7 '16 at 23:05
4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.