quiz: count extensions

A collection of especially useful xplorer² topics and ideas. New users may find it helpful to look here before searching the other forums for information. >>>>>> Please post new material in the relevant forum. (New stuff posted here will be removed.) Thanks. -fg-

Moderators: fgagnon, nikos

Post Reply
User avatar
nikos
Site Admin
Site Admin
Posts: 15800
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

quiz: count extensions

Post by nikos »

This thread was originally posted  in the xplorer² Professional forum.        
Moved here 19-May-2010 =fg=
=====================================================


as part of some programming i'm doing, i want to count the number of different file types (extensions) on my hard disk. I want xplorer2 to help me with the task but i can't think of an easy way!

i started by flattening all C:\ in a scrap and grouping by extension. Problem is there's no way to get a count of the groups. I could export colum data in excel and write a couple of macros for the counting part, but is there a smarter way to do it using only x2?

( i don't know the answer myself! )
Robert2
Gold Member
Gold Member
Posts: 673
Joined: 2004 Jun 17, 15:39

Post by Robert2 »

in case you cannot achieve this in xplorer, you could use "WinDirStat" from http://windirstat.info
User avatar
nikos
Site Admin
Site Admin
Posts: 15800
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

in the end i wrote a simple C++ program to do the counting for me :)
it's interesting to see if any creative mind will come up with a solution within xplorer2 though  :?:
BRX
Silver Member
Silver Member
Posts: 304
Joined: 2002 Feb 08, 12:12

Post by BRX »

Actually there's a way I can think of.

I'm always saying there's almost nothing you can't do filewise with x2 (if you don't count out working with the command-line and with an editor).

So here my solution to your challenge:

After flattening select all the files. Use the Batch assistant with Ctr-B and type in mkdir $E (preferably with a path so you get the new dirs at a place you want).

Now you have for each extension a (single) directory. Change to that location, select all dirs in x2 and you see how many items there are = the number of different extensions.
infimum
New Member
Posts: 5
Joined: 2007 Dec 31, 01:45

Post by infimum »

Vista's explorer shows the number of items in each group (with the group-view on). Is there any plan to incorporate this feature (at least for Vista users)?

N.B. Another new feature of Vista is that each group is "collapsible".
User avatar
nikos
Site Admin
Site Admin
Posts: 15800
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

nice one BRX, you get a phd in x2 :D

infimum, if you click on a group header in vista you select all the files and then you can read the items in this group on the statusbar
narayan
Platinum Member
Platinum Member
Posts: 1430
Joined: 2002 Jun 04, 07:01

Post by narayan »

And in using Excel also, the method does not require any macros:

1. Press ALT+K. Select extension column, and remove other columns.

2. Flatten the folder. Press CTRL+A and then CTRL+P.

3. Paste the list in Excel.

4. Add a column (with QTY as header). Enter 1 (number) in each row.

(TIP: To do this, enter 1 in one cell. Then press CTRL and double-click on thAT CELL'S bottom right corner. The entire column is filled automatically with 1's)

5. Now create a pivot table. Select extension and QTY columns. The sum function will give you the total for each extension.
bst
New Member
Posts: 7
Joined: 2008 May 15, 21:38
Location: Germany

Post by bst »

With cygwin or unix tools like unxutils you could:

start batch assi and use: $echo $E >> c:\allext.txt

in address bar use: $tr A-Z a-z < c:\allext.txt | sort | uniq | wc -l

cu, Bernd
User avatar
johngalt
Gold Member
Gold Member
Posts: 561
Joined: 2008 Feb 10, 19:41
Location: 3rd Rock
Contact:

Post by johngalt »

Ya'll are missing the point:
nikos wrote:but is there a smarter way to do it using only x2?
Image

Image
narayan
Platinum Member
Platinum Member
Posts: 1430
Joined: 2002 Jun 04, 07:01

Post by narayan »

We know- We just expanded the scope! :)
Post Reply