Only first-level subfolders or all folders regardless of level?
Get count of first-level subfolders only
If you just need the subfolder-count of a single folder, just select that folder and enter this code in the addressbar:
Code: Select all
::if(exists(<curitem>)==2){text "<curitem><crlf>contains ".(0 + listfolder(<curitem>,,34))." subfolders"}
you can also make XY show subfolder count in a dedicated column for all listed folders. Copy the following code, then ENTER ::snippet <clipboard>; in XY addressbar.
Code: Select all
Snip: CustomColumn 1
Action
ConfigureColumn
Caption
Subdir Count
Type
3
Definition
//returns count of first-level subfolders
return 0 + listfolder(<cc_item>,,34);
Format
2
Trigger
0
Item Type
1
Item Filter
a new custom column called Subdir Count will be generated. add that column to the filelist.
=============
Get total number of subfolders under the parent folder regardless of nesting level
Use these codes
instead (note that these can be quite slow).
code for single folder info:
Code: Select all
::if(exists(<curitem>)==2){text "<curitem><crlf>contains ".gettoken(folderreport(dirsrel,r,<cc_item>,r,,'|'),count,'|')." subfolders"}
Code for the custom column:
Code: Select all
Snip: CustomColumn 1
Action
ConfigureColumn
Caption
Subdir Count
Type
3
Definition
//returns count of first-level subfolders
return gettoken(folderreport(dirsrel,r,<cc_item>,r,,'|'),count,'|');
Format
2
Trigger
0
Item Type
1
Item Filter
[edit.]