List of all file extensions used

General discussion related to "Everything".
Post Reply
Claudio Salvio
Posts: 13
Joined: Tue Jul 02, 2013 9:45 pm

List of all file extensions used

Post by Claudio Salvio »

Hello

Every now and then, I need to make a list of all file extensions used on a Windows computer.

So far I have used a piece of PowerShell code like this to perform the task:
$ext = @{}; Get-ChildItem -Filter *.* -Force -Recurse | ForEach-Object{ $ext[$_.Extension]++ }; $ext

I find this method adequate except for the time it takes to perform the task.

Because of the latter, a question arose for me: is there a quick way to get that information using Everything?
I have no problem if the list contains the name of a file of each extension.

Regards,
Claudio

I 🧡 Everything, if you love it too, please donate if you can.
It is good to recognize the work of those who generate such useful products as Everything and give us so much freedom to use it and to give our thanks.
Mizufluffy
Posts: 62
Joined: Sun Jun 13, 2021 10:22 am

Re: List of all file extensions used

Post by Mizufluffy »

What I just tried myself, after reading your question, was this:
First I added 'Extension' column: Right click one of the column titles > Add Columns... > Everything Properties > Extension > Ok.
Then I searched for this:

Code: Select all

files: distinct: sort:extension
I took a look at the list it gave me and glanced over the Extension column and I didn't really see same extension more than once. However, in my case there are some weird ones, some really long ones etc. but it seemed to work well enough. I had about 2400+ hits on my list.
harryray2
Posts: 1053
Joined: Sat Oct 15, 2016 9:56 am

Re: List of all file extensions used

Post by harryray2 »

Any idea how to use file: sort:extension but not show files without an extension?

Also distinct: is a new one to me, what's it used for?

Thanks
horst.epp
Posts: 1361
Joined: Fri Apr 04, 2014 3:24 pm

Re: List of all file extensions used

Post by horst.epp »

Just for interest, for what purpose do you need such a list.
Normaly I'm only interested on a few extensions which I have on daily use.
I even have a folder which test files for this extensions to check preview and thumbnail functions.
But for what reason do I need to know all the other extensions ?
therube
Posts: 4655
Joined: Thu Sep 03, 2009 6:48 pm

Re: List of all file extensions used

Post by therube »

Any filename with a (.) in it is considered to have an extension.
In the above case, any filename with more then one (.) in it, then extension is considered as the final (.) & all that follows.

So
#347 - Adam McKay.mp3awcollectionid=the-empire-podcast&awepisodeid=14019
has an extension of
.mp3awcollectionid=the-empire-podcast&awepisodeid=14019

And
$$DeleteMe.advapi32.dll.01d70ed7f3a01559.002b
has an extension of
.002b

An extension can contain a space in it
11. Updates
has an extension of
. Updates


You could add a (.) to your search (or regex:\.) [there could be slight differences between the two] to weed out files with no extension.
tuska
Posts: 942
Joined: Thu Jul 13, 2017 9:14 am

Re: List of all file extensions used

Post by tuska »

harryray2 wrote: Fri Jul 23, 2021 3:35 pm Any idea how to use file: sort:extension but not show files without an extension?

Code: Select all

!folder: !files:regex:^[^.]*$ sort:extension
Source: show all files without extension (Regex)
harryray2 wrote: Fri Jul 23, 2021 3:35 pmAlso distinct: is a new one to me, what's it used for?
Syntax -> Ctrl+F -> distinct:
Find unique results (show only one result when there are duplicates) based on the current sort order.

Use sort: to specified the sort order.

Example:
sort:name distinct:
harryray2
Posts: 1053
Joined: Sat Oct 15, 2016 9:56 am

Re: List of all file extensions used

Post by harryray2 »

Thanks for that, I'm useless with regex. I've just noticed that there are a load of files with numbers as the extension, is there a way of filtering these out as well?
tuska
Posts: 942
Joined: Thu Jul 13, 2017 9:14 am

Re: List of all file extensions used

Post by tuska »

Sorry, I forgot...
distinct: Should be used additionally! -> "DUPE" is then displayed at the bottom right in the status bar:

Code: Select all

!folder: !files:regex:^[^.]*$ distinct: sort:extension
Regarding your question, it is now too complicated for me, since I do not know RegEx either.

Maybe only this hint from me:
There can be e.g. also file extensions, which
- are mixed (numbers and characters)
- start with '-'. hyphen
- start with '_' underscore

Maybe you should explain what you want to do with these file extensions.
Unfortunately I can't help you any further here.
Claudio Salvio
Posts: 13
Joined: Tue Jul 02, 2013 9:45 pm

Re: List of all file extensions used

Post by Claudio Salvio »

Mizufluffy wrote: Fri Jul 23, 2021 3:20 pm What I just tried myself, after reading your question, was this:
First I added 'Extension' column: Right click one of the column titles > Add Columns... > Everything Properties > Extension > Ok.
Then I searched for this:

Code: Select all

files: distinct: sort:extension
I took a look at the list it gave me and glanced over the Extension column and I didn't really see same extension more than once. However, in my case there are some weird ones, some really long ones etc. but it seemed to work well enough. I had about 2400+ hits on my list.
Thank you Mizufluffy!

I was looking for something like this.
I was not aware of the availability of distinct:.

I tried the expression in Everything 1.4.1.1005 (x64) and it did not work, however in Everything 1.5.0.1269a (x64) it did.
Because of this, I assume it was incorporated in version 1.5.

On the computer where I did the test it returned about 7760 extensions.

In some use cases, I need to curate the list.

Something I overlooked is that in those cases the number of files each extension has is useful for filtering them out from the list.

That data is returned by the PowerShell code but not by your Everything expression.
I still consider that the expression you proposed is useful and responds to my request for help, even if I cannot use it for all my use cases.

Thanks again.
Regards.
Claudio Salvio
Posts: 13
Joined: Tue Jul 02, 2013 9:45 pm

Re: List of all file extensions used

Post by Claudio Salvio »

horst.epp wrote: Fri Jul 23, 2021 3:39 pm Just for interest, for what purpose do you need such a list.
Normaly I'm only interested on a few extensions which I have on daily use.
I even have a folder which test files for this extensions to check preview and thumbnail functions.
But for what reason do I need to know all the other extensions ?


Hello horst.epp

Some use cases that I quickly recall:
  • detect extensions that are not associated with the appropriate types and can benefit from making some registry change that relates it to a well established file type or to certain verbs that may be useful
  • scan a system, sometimes due to some kind of forensic task
Greetings,
Claudio
harryray2
Posts: 1053
Joined: Sat Oct 15, 2016 9:56 am

Re: List of all file extensions used

Post by harryray2 »

Thanks tuska, amazingly I managed to work it out myself..it's !regex:[0-9].

My next problem is, and I don't think I'll work this one out myself, is to limit the extension to three letters....exe .mp4 etc. There are some files with just one,two or many letters in the extension
Mizufluffy
Posts: 62
Joined: Sun Jun 13, 2021 10:22 am

Re: List of all file extensions used

Post by Mizufluffy »

harryray2 wrote: Fri Jul 23, 2021 6:48 pm My next problem is, and I don't think I'll work this one out myself, is to limit the extension to three letters....exe .mp4 etc. There are some files with just one,two or many letters in the extension
If you add this regex in your search then it should limit it to 3 characters:

Code: Select all

regex:"\.\w{3}$"
Note: This pattern includes extensions with numbers so you can combine it with your other regex to exclude numbers.

It starts with \. so it is treated literally as . instead of as any character.
Then \w stands for word characters. Alternatively you could, for example, use [a-z] to include only characters from a to z.
The {3} is there just to count exactly three of the previous occurances, so for example three word characters.
It ends with $ which means the end of string.

If you want to try various regex patterns you could do it here: https://regex101.com/
I've used that site myself whenever I try to make anything little bit more complicated.
harryray2
Posts: 1053
Joined: Sat Oct 15, 2016 9:56 am

Re: List of all file extensions used

Post by harryray2 »

Thanks that's useful, but my problem is I'm trying to include extensions with just 2 or 3 characters. I can get rid of a one character extension in a silly way with !*.? but that doesn't help with more than 3.
Mizufluffy
Posts: 62
Joined: Sun Jun 13, 2021 10:22 am

Re: List of all file extensions used

Post by Mizufluffy »

harryray2 wrote: Fri Jul 23, 2021 8:07 pm Thanks that's useful, but my problem is I'm trying to include extensions with just 2 or 3 characters. I can get rid of a one character extension in a silly way with !*.? but that doesn't help with more than 3.
If you want both 2 and 3 character long extensions then you can simply do

Code: Select all

regex:"\.\w{2,3}$"
The {2,3} means the length is between 2 and 3. That way extensions with length 0, 1, 4 or higher won't show up.
For example, .ab and .abc will show but .a or .abcd does not.
harryray2
Posts: 1053
Joined: Sat Oct 15, 2016 9:56 am

Re: List of all file extensions used

Post by harryray2 »

As Alan Partridge would say, AH HA!! Thanks so much, that's the one..I tried putting in the 2 and the 3 but I didn't know about the comma.
I assume the comma means and?
Mizufluffy
Posts: 62
Joined: Sun Jun 13, 2021 10:22 am

Re: List of all file extensions used

Post by Mizufluffy »

Do you mean and as in "2 and 3"? Not really. It simply describes a range from one value to another value. For example, {5,50} would mean "from 5 to 50" instead of "5 and 50".
Also, it is possible to leave upper value out and do {5,} in which case it means "5 or more".
harryray2
Posts: 1053
Joined: Sat Oct 15, 2016 9:56 am

Re: List of all file extensions used

Post by harryray2 »

That explains it nicely...thanks again.
NotNull
Posts: 5307
Joined: Wed May 24, 2017 9:22 pm

Re: List of all file extensions used

Post by NotNull »

Claudio Salvio wrote: Fri Jul 23, 2021 6:23 pm Because of this, I assume it was incorporated in version 1.5.
Correct!

On the computer where I did the test it returned about 7760 extensions.
In some use cases, I need to curate the list.
Note that Everything finds all file extensions on all drives indexed. Your Powershell script will find only extensions in the starting folder and beyond. You could add a path to your search query/queries to limit the search to only that folder (and below)

Something I overlooked is that in those cases the number of files each extension has is useful for filtering them out from the list.


ExtFrequency.ps1

Code: Select all

es.exe  file: !ext: distinct: sort:extension -ext -export-csv .\exts.csv
import-csv .\exts.csv -Encoding utf8 | select Extension, @{name='Frequency';expression={[int](es.exe ext:"""$($_.Extension)""" -getresultcount) }}
Output:

Code: Select all

Extension                                                          Frequency
---------                                                          ---------
0                                                                         82
0, Culture=neutral, PublicKeyToken=adb9793829ddae60                       16
0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51                        1
0-2f9188b68640dbf72295f9083a21d674a314721ef06f82db281cbcb052ff8ec1         1
0-beta1                                                                    1
0-custom3                                                                  1
0-preview1                                                                 1
0-preview20210318001                                                       1
000                                                                        2
001                                                                        3
002                                                                        3
003                                                                        3
004                                                                        2
01                                                                         1
1                                                                         15
1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51                        1
[...]
You can save the reslts to file with Export-Csv, Out-File, etc.


This PowerShell code is only briefly tested, so please test carefully before going into production with it.

It requires ES.exe, the command-line tool to extract information from a running Everything.
For ES.exe to work with the alpha version of Everything 1.5, you need to create an ES.ini in the same fodler with the following content:

ES.INI

Code: Select all

[ES]
instance=1.5a



Note:
Will probably be faster than youroriginal PowerShell command, but still has to fire 7760 queries at Everything to get the frequency for each extension.
tuska
Posts: 942
Joined: Thu Jul 13, 2017 9:14 am

Re: List of all file extensions used

Post by tuska »

Latest version: ES-1.1.0.19

2void
Please update the download page.
Thank you!
NotNull
Posts: 5307
Joined: Wed May 24, 2017 9:22 pm

Re: List of all file extensions used

Post by NotNull »

harryray2 wrote: Fri Jul 23, 2021 6:48 pm My next problem is, and I don't think I'll work this one out myself, is to limit the extension to three letters....exe .mp4 etc.
regex:^.*\.[^.]{3}$
harryray2
Posts: 1053
Joined: Sat Oct 15, 2016 9:56 am

Re: List of all file extensions used

Post by harryray2 »

Thanks, I was also given this regex:"\.\w{3}$"

It seems to give the same result, what's the difference, is one better than the other?
NotNull
Posts: 5307
Joined: Wed May 24, 2017 9:22 pm

Re: List of all file extensions used

Post by NotNull »

Not really. I suspect that the one I posted is a little bit faster as it has more anchors (the ^ and $; those are the starting- and endpoint of the filename). But I'm too lazy to test atm ...

So, use whatever you like best; you probably won't even notice any speed difference with Everything :)

EDIT: My version will also find "file.---", so maybe better use the other one
harryray2
Posts: 1053
Joined: Sat Oct 15, 2016 9:56 am

Re: List of all file extensions used

Post by harryray2 »

Thanks, I'm going to have to start learning regex...
Post Reply