Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: fix invalid jpg extension (Read 1177 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

fix invalid jpg extension

This might be old news, but I discovered a utility to add the proper extension to files automatically.
I had quite a few album art downloads that were labeled *.jpg, but are actually *.png .
This utility can fix that:  TrID - File Identifier
I had some trouble doing a batch conversion at first, but I found the trick.
Use "dir /b /s > filename.txt" to create a file with all that you want to check/convert, then do "type myfilelist.txt | trid -ce -@"
(You can use wildcards with the dir command, I looked for "folder.jpg".)
This is helpful if you display album art and it is sometimes not found because of the improper file extension.

BTC:  1EFvqvn51n7qW9yHZHDHPnBZxN17EafUt1

Re: fix invalid jpg extension

Reply #1
Use "dir /b /s > filename.txt" to create a file with all that you want to check/convert, then do "type myfilelist.txt | trid -ce -@"
(You can use wildcards with the dir command, I looked for "folder.jpg".)
It's not necessary to use an intermediate file - the information you linked to already provides the solution:

Quote
TrID can get a file list from stdin, with the -@ switch.
So it's possible to work on an entire folder tree, or a particular subset of files, just using the output of some other command through a pipe. Something like:

Code: [Select]
C:\TrID>dir d:\recovered_drive /s /b | trid -ce -@

I've not tried it, but it would be more conventional to do something like:
Code: [Select]
for /r %g in (<filespec>) do trid -ce %g

/r specifies recurse subfolders; change % to %% if putting this line into a .bat.
It's your privilege to disagree, but that doesn't make you right and me wrong.

Re: fix invalid jpg extension

Reply #2
Thanks, just tried the first method you mentioned, works great!
BTC:  1EFvqvn51n7qW9yHZHDHPnBZxN17EafUt1

Re: fix invalid jpg extension

Reply #3
Where are you finding all the possible switches? I tried the old DOS convention of trid /h and trid /? and got nothing. (Except "error. no file found")

Re: fix invalid jpg extension

Reply #4
>trID.exe -?

TrID/32 - File Identifier v2.24 - (C) 2003-16 By M.Pontello

Usage: TrID <[path]filespec(s)...> [-ae|-ce] [-d:file] [-ns] [-n:nn]
                                   [-@] [-v] [-w] [-?]

Where: <filespec> Files to identify/analyze
       -ae        Add guessed extension to filename
       -ce        Change filename extension
       -d:file    Use the specified defs package
       -ns        Disable unique strings check
       -n:nn      Number of matches to show (default: 5)
       -@         Read file list from stdin
       -v         Verbose mode - display def name, author, etc.
       -w         Wait for a key before exiting
       -?         This help!
korth

Re: fix invalid jpg extension

Reply #5
Thanks korth.   8)

BTW, can I use DOS wildcards in the filename? And what separator do I use between multiple filenames?

Re: fix invalid jpg extension

Reply #6
- is the command switch prefix in Linux, so it seems like this .exe is a port from Linux to Windows.
It's your privilege to disagree, but that doesn't make you right and me wrong.