Folder File Count Column?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
binar
Posts: 21
Joined: 11 Aug 2013 05:32

Folder File Count Column?

Post 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 Available
Columns Available
Columns.jpg (33.18 KiB) Viewed 7664 times

highend
Posts: 14733
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Folder File Count Column?

Post 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...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 65546
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Folder File Count Column?

Post 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... :biggrin:

binar
Posts: 21
Joined: 11 Aug 2013 05:32

Re: Folder File Count Column?

Post 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.

highend
Posts: 14733
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Folder File Count Column?

Post 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
(1.96 KiB) Downloaded 349 times
One of my scripts helped you out? Please donate via Paypal

Schmart
Posts: 1
Joined: 01 Apr 2014 09:15

Re: Folder File Count Column?

Post 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
ItemCount.png (9.46 KiB) Viewed 7515 times
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".

Sander Bouwhuis
Posts: 246
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Folder File Count Column?

Post 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.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

admin
Site Admin
Posts: 65546
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Folder File Count Column?

Post 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()...

Sander Bouwhuis
Posts: 246
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Folder File Count Column?

Post 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?
Last edited by Sander Bouwhuis on 28 Apr 2014 18:19, edited 1 time in total.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

admin
Site Admin
Posts: 65546
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Folder File Count Column?

Post 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
  

FluxTorpedoe
Posts: 904
Joined: 05 Oct 2011 13:15

Re: Folder File Count Column?

Post 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
CC_ExtSize.png (16.46 KiB) Viewed 7417 times
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, 8)
Flux

Edit: didn't see Don posted while I was writing... He's too fast! :twisted: )
Last edited by FluxTorpedoe on 29 Apr 2014 08:18, edited 1 time in total.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Folder File Count Column?

Post 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. ;)

admin
Site Admin
Posts: 65546
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Folder File Count Column?

Post 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... :om: :beer:

admin
Site Admin
Posts: 65546
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Folder File Count Column?

Post 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
  
Attachments
2014-04-28_194909.png
2014-04-28_194909.png (14.06 KiB) Viewed 7404 times

Sander Bouwhuis
Posts: 246
Joined: 10 Jun 2008 15:40
Location: Netherlands

Re: Folder File Count Column?

Post 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 :appl:
Thanks everyone for helping.
(\__/)
(='.'=) This is Bunny. Copy and paste bunny into
(")_(") your signature to help him gain world domination.

Post Reply