Page 1 of 2
Folder File Count Column?
Posted: 23 Dec 2013 03:40
by binar
Fellow Forum Members,
I'm using XYplorer and I can't seem to setup a column that will list the quantity of files contained within each folder. My goal is to sort a bunch of folders only by the quantity of files contained within each folder. Is it possible to setup such a column in XYplorer because I don't see such an option available as shown in the screen capture below:
Columns.jpg
Re: Folder File Count Column?
Posted: 23 Dec 2013 09:09
by highend
Afaik not possible...
A (manual) workaround:
A script that counts all files in all current subfolders, stores the count in a tag associated to each folder and then you can sort by tag...
Ofc you have to rerun that script when necessary...
@Don:
How about a feature that executes script on specific times / events, something like a scheduler for scripts?
So sad that we can't run several scripts at the same time...
Re: Folder File Count Column?
Posted: 23 Dec 2013 09:18
by admin
Well, you can come close if you tick
Configuration | Tree and List | List | Show item count with folder sizes. But the sorting will not work.
>So sad that we can't run several scripts at the same time...
Well, true multi-threading is coming to XYplorer, so there is a lot of hope here...

Re: Folder File Count Column?
Posted: 24 Dec 2013 01:37
by binar
Thanks to all for your post.
I'm surprised an app like XYplorer with all of the high level things it can do misses the mark when it comes to offering a way to sort folders by the amount of items contained in a folder.
Highend, do you know if the script you mention exists somewhere in this forum? I would really like to add it to my collection of scripts. One of which you were so kind enough to help me out with in some other thread I posted. If the script you mention does not exist anywhere, would you again be so kind enough to post it in this thread? I'm sure everyone that uses XYplorer will appreciate it a lot because it is very helpful to have the ability to sort folders by the quantity of items it contains within. Thank you in advance.
Re: Folder File Count Column?
Posted: 24 Dec 2013 03:17
by highend
It creates values for
all folders (recursively) in the
current tab's path.
Ofc it's a total count
but none of the accounted subfolders get's a value as well.
I'm using the comments field instead of a tag. No need to parse existing tag entries...
Atm this script does only work with a non localized XYplorer... but ofc it could be "translated" as well...
1. Edit: Made it multiple times faster by using a dump with some regexes / calculating...
2. Edit: Runs on XY with either english / german language
3. Edit: Using the tags instead of comment field. Be careful, tags are
overriden!
Current version v2013.12.24.11.56.22
CountItems.xys
Re: Folder File Count Column?
Posted: 01 Apr 2014 09:22
by Schmart
For the people still interested in the count of items in a folder; with the new Custom Columns feature, I was able to implement this using a simple script like so:
ItemCount.png
I'm completely new to scripting in XYplorer, so I'm open to suggestions if there is a quicker or better way to accomplish this.
Edit: changed the format from "Text" to "Number".
Re: Folder File Count Column?
Posted: 28 Apr 2014 16:56
by Sander Bouwhuis
Ok, I might be a complete idiot, but how do I use the 'File count' property?
Although the script the guy above me wrote works, I'd prefer to use the built-in routine.
Caption : Tot Files
Type : Property
Property : File count
Format : Number
Trigger : Browse
Item type : Folders
Item filter :
But, nothing happens. I don't see the file count.
Also:
How do I get the amount of bytes in a folder? I want to replace the current Size column and split them in two.
1. A column named Tot Files which counts the amount of files in the directory.
2. A column named Size which counts the amount of bytes in the directory or file.
Re: Folder File Count Column?
Posted: 28 Apr 2014 18:00
by admin
Conc. the 'File count' property: it does not work here either. No idea why. These properties are hardly documented by MS.
How do I get the amount of bytes in a folder?
Look at SC FolderSize()...
Re: Folder File Count Column?
Posted: 28 Apr 2014 18:11
by Sander Bouwhuis
I tried Foldersize(), but couldn't get it working.
Can you tell me which settings/scriptlines I need to do to get the two columns I described in my previous post?
Thank you very much in advance. I've been wanting this for years (having come from Dopus).
Edit:
Never mind, I found it. I can simply use the normal 'Size' column. I just had to turn off the 'Show item count with folder sizes' off.
But, is the script really the fastest way XyPlorer can count the amount of files in a folder? Or are you going to fix the 'File count' property?
Re: Folder File Count Column?
Posted: 28 Apr 2014 18:18
by admin
Tip: You can paste this into a Custom Column definition (right-click the "Clear" button).
Code: Select all
Snip: CustomColumn 1
XYplorer 14.00.0001, 28.04.2014 18:17:18
Action
ConfigureColumn
Caption
Folder Size
Type
3
Definition
return foldersize(<cc_item>, <b>);
Format
1
Trigger
0
Item Type
1
Item Filter
Re: Folder File Count Column?
Posted: 28 Apr 2014 18:36
by FluxTorpedoe
Hi'
iycgtptyarvg wrote:1. A column named Tot Files which counts the amount of files in the directory.
2. A column named Size which counts the amount of bytes in the directory or file.
I'm in a rush, so no time to detail right now, but as a matter of fact those were the first CCs I created!
CC_ExtSize.png
So here they are, they're still a work in progress but it should give you something to tinker with:
1. Ext+
- For folders, displays:
FolderCount (NbSubFolders.NbFiles)
It's pretty stripped-down because I found it the easiest to interpret — fastest to read than e.g. Total:45(Dirs:3 / Files:42)
- For files, it depends on audio or images, etc. (WorkInProgress)
Edit: Much faster code for folders (less disk access)Code: Select all
if <cc_isfolder> {
$NbDirs = foldersize(<cc_item>, "<d>");
$NbFiles = foldersize(<cc_item>, "<f>");
return $NbDirs+$NbFiles." ($NbDirs.$NbFiles)";
} else {
if ("jpg;jpeg;png;gif;psd;tif;tiff;bmp;ico" Like "*<cc_ext>*") {
return property("#image.dimensions", <cc_item>);
} elseif ("mp3;wav;ogg" Like "*<cc_ext>*") {
return property("#audio.length", <cc_item>);
} elseif ("wma;avi;mkv;mp4;divx;mpg;mpeg" Like "*<cc_ext>*") {
return property("#27", <cc_item>);
} else {
return <cc_ext>;
}
}
[/size]
Old code was:Code: Select all
if <cc_isfolder> {
return report("{count}", <cc_item>)." (".foldersize(<cc_item>, "<d>").".".foldersize(<cc_item>, "<f>").")";
}
[/size]
2. Size+
returns the total size of folders or files always in MB (same as above: after some trials, fastest to interpret on screen for me)
Code: Select all
if <cc_isfolder> {
return formatbytes(foldersize(<cc_item>, "<r>"), "MB", 1);
} else {
return formatbytes(report("{size}", <cc_item>), "MB", 1);
}
[/size]
Hope this helps,
Flux
Edit: didn't see Don posted while I was writing... He's too fast!
)
Re: Folder File Count Column?
Posted: 28 Apr 2014 18:43
by TheQwerty
iycgtptyarvg wrote:Or are you going to fix the 'File count' property?
That particular property is provided by Windows, so it's up to Microsoft to issue a fix. Seeing as enabling it in Explorer continues to give you a nice empty column in Windows 8, I think you might be better off using a script column.

Re: Folder File Count Column?
Posted: 28 Apr 2014 18:50
by admin
There is still the problem with
sorting the formatted sizes. I will add a new CC format "bytes" that will take care of it. Let me just eat something...

Re: Folder File Count Column?
Posted: 28 Apr 2014 19:50
by admin
In the next beta you can do this (Format 6 = Bytes!):
Code: Select all
Snip: CustomColumn 1
XYplorer 14.00.0001, 28.04.2014 19:45:48
Action
ConfigureColumn
Caption
Folder Size
Type
3
Definition
return foldersize(<cc_item>, <r>);
Format
6
Trigger
0
Item Type
1
Item Filter
Re: Folder File Count Column?
Posted: 29 Apr 2014 08:17
by Sander Bouwhuis
Don, regarding your suggestion:
return foldersize(<cc_item>, <b>);
This doesn't work because I get 'Access denied' script errors.
Anyway, I got it working now. I've been waiting for this for a long time
Thanks everyone for helping.