Page 1 of 1

Files Count on List

Posted: 04 Jul 2023 01:00
by TedL1972
Hello,

I posted this in "Wishes" but I realized it might have been the wrong place so I am posting it here as it appears more appropriate.

In short I would like to know if there is a way to show in a single column within a TAB list ONLY the number of files or documents contained in every folder and subfolder in a directory.

There is already a feature that does this in part:

Tools|Configuration|General|Tree and List|Show item count with folder size.

What I am asking is whether "Show item count" can be separated to show on its own column. In other words I would like to be able to show the number of documents in each folder and subfolder without the "folder size" as the latter sometimes takes some time to show up.

Can anyone advise if this feature already exists or a simple script to make it possible?

Thank you.

Re: Files Count on List

Posted: 04 Jul 2023 01:14
by jupe
Create a new custom column, and use this variable <prop #ItemCount> unlike the inbuilt column values though, it isn't recursive, if you needed it to be, you can use alternate scripting methods, eg foldersize()

https://www.xyplorer.com/release_13.90. ... bleColumns

Re: Files Count on List

Posted: 04 Jul 2023 01:34
by TedL1972
I tried to make a custom column with the script line you suggested but I must be doing something wrong.

Could you please list some of the key steps as there are several variables to chose from and I I got a bit lost.

If by recursive you mean that I would want for the number of files to show up all the time yes that's the case
exactly like for instance the "Size" column which shows the exact size of a document so I would like the script
to show the exact number of documents contained in a folder.

Thank you very much.

Re: Files Count on List

Posted: 04 Jul 2023 01:41
by jupe
That's not what I meant by recursive, anyway if you are happy with the totals in the inbuilt column, then this will display the same:

return eval(foldersize(<cc_item>, "<d>+<f>"));

If you only want the count of files then use this instead:

return foldersize(<cc_item>, "<f>");

Re: Files Count on List

Posted: 04 Jul 2023 02:11
by TedL1972
Worked perfectly, thank you!!!!!

:appl:

Re: Files Count on List

Posted: 05 Jul 2023 14:45
by sasumner
The short scripts by Jupe are cool; they work, I like them.

I'd like to always have such columns enabled, but I find when switching to the root of a drive with a lot of files, it takes a long time to calculate the data, resulting in a UI delay.

I understand this (it has a lot of work to do), but I'm thinking about lengthening these scripts such that it doesn't do all that work for the root folder, or maybe if it finds more than, say 500 files, it stops and just shows "500+" in the column.

Re: Files Count on List

Posted: 05 Jul 2023 15:17
by highend
Then prepend something like if regexmatches(<cc_path>, ":\\$") { return "--"; } in front of it?