Determine & add correct file extensions

If you have a bunch of files whose extensions are missing or incorrect, this button can help.

The button uses the free, small TrID tool to inspect each file, guess its type and append the most likely file extension. Although it is guessing, it is very reliable with image and archive formats.

Note that any existing extension will be left on the file, with the new extension being added after it. You might want to remove existing extensions (e.g. using a trivial wildcard or regexp rename) before using the button.

Getting TrID

TrID can be obtained from here, under the Download heading: mark0.net/soft-trid-e.html

You must download both TrID itself (the Win32 version, trid_w32.zip) and its definitions file (triddefs.zip) and extract them to the same place. If you put them in C:\Program Files\TrID then you won't have to edit the button.

The button

Here is the button code which you can paste to a toolbar or menu:

<?xml version="1.0"?>
<button backcol="none" display="both" textcol="none">
	<label>Add file extensions</label>
	<icon1>#filetype2</icon1>
	<function type="batch">
		<instruction>&quot;%PROGRAMFILES%\TrID\trid.exe&quot; {filepath$} -ae</instruction>
		<instruction>pause</instruction>
	</function>
</button>

That's it; now just select some files and click the button.

4 Likes

Really useful, thanks for the tip leo, I didn't knew about that little app!

But the site seems to be down at the moment, here is another link where it can be downloaded (for those who doesn't like to wait :wink:), it's in french, but to get the files, I don't think it would be a problem!

http://download-society.niloo.fr/index.php?file=Sections&op=article&artid=58

The original site seems fine to me.

it works fine for me now... the site was temporarily down or maybe I have a restricted access to it from work!

anyways, thanks again, it works really fine!

I have some trouble with this function. I runs sometimes. From 10 click to button only 1 times it works.

That button is interesting, but what would be amazing is a column that shows the guessed extensions.

Does anyone know if the database used in TrID or an equivalent is available? I guess http://mark0.net/soft-tridnet-e.html could not be easily integrated in a plugin because it's c#?

Edit: I meant http://mark0.net/code-tridengine-e.html. I also see that there's a DLL available: http://mark0.net/code-tridlib-e.html

I've just seen that the definitions can be downloaded in XML. So it seems doable, just more complicated than what I anticipated...

It might be possible to run TrID and convert the output into a column.

If you'd like us to take a look, please link your account.

Thank you for your answer.

I'm still evaluating the product, and I may wait for a discount to buy it (these licenses are too expensive for me, I use 3 different desktop computers and the non-profit organization where I work will not pay for it)

I'll have a look at the forum for an example, and I'll post my results here. I believe I'll figure it out.

It's Work for me. Thanks for the Tip Leo.

I found another option:

If you use the ExifToolColumns-Plugin (script) you can add the following line:
"File__FileTypeExtension": "and give the column any name you choose"

Then you can use Advanced Rename to rename files without an extension using that column.

1 Like

I had missed this old post from @Leo .
I downloaded it today and got it working.
I found immediately that the definitions were able to identify old HP calculator files which have only a DOT as an extension.

It was able to differentiate between HP 48 series and HP 49 series, which incudes the 50G, only.

However It couldn't differentiate between simple programs and libraries of programs which would be wanted to have been labeled a bit differently with a .lib in the absence of any file structure correctly identifying them. Libraries are installed much differently on old HP calculators. Sometimes libraries can be spilt into binary programs with the right hacking tools

Yes there are easier ways to do this but it's good to know that this exists and have this.

You can find plenty of test files at HPCalc.org .