ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: ziongates on April 29, 2020, 04:22:24 PM

Title: Can exiftool append correct Extension to an extensionless file?
Post by: ziongates on April 29, 2020, 04:22:24 PM
Greetings Gurus, I have a folder with numerous files without extensions.
Can Exiftool determine the proper extension of a image file and rename the file (anonymous to anonymous .webp)?
Title: Re: Can exiftool append correct Extension to an extensionless file?
Post by: StarGeek on April 29, 2020, 04:25:59 PM
Try the command in this post (https://exiftool.org/forum/index.php?topic=10699.msg56818#msg56818).
Title: Re: Can exiftool append correct Extension to an extensionless file?
Post by: ziongates on April 29, 2020, 05:13:12 PM
Greetings Stargeek that seems like exactly what I seek to accomplish, however the command is not working on Windows OS. I tried to change the single quotes to double quotes however it's saying '1 directory read zero changes'

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

I got the code below to work though, thanks Stargeek.
exiftool -ext "*" "-FileName<%%f.$FileTypeExtension" -r "D:\APPZ\exiftool\test"
Title: Re: Can exiftool append correct Extension to an extensionless file?
Post by: Phil Harvey on April 29, 2020, 07:25:01 PM
Try this:

exiftool -ext "*" "-FileName<%f.$FileTypeExtension" "D:\APPZ\exiftool-11.97\yyu\"

There was a problem with the "%" characters in your command, plus it renamed the files according to the date, which you didn't say that you wanted.

Also, be sure the files are in the specified directory.

- Phil
Title: Re: Can exiftool append correct Extension to an extensionless file?
Post by: ziongates on April 30, 2020, 04:38:15 PM
Thank you for your help, mission accomplished, this is a GREAT app!