Search for folders with specified number of subfolders

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
rqqt
New Member
New Member
Posts: 1
Joined: 2018-06-09, 01:32 UTC

Search for folders with specified number of subfolders

Post by *rqqt »

I'm trying to find directories with more than X number of subdirectories.

I can do that already with DirSizeCalc or FileX plugins, but the results show ALL the subfolders.

Is it possible to just show the top-most folder?

For example:

If you have:

Code: Select all

a\1\2\3\foo.txt
b\1\2\3\foo.txt
TC will show this in the results:

Code: Select all

a
1
2
3
b
1
2
3
I just want the results to show the top-most folder, like this:

Code: Select all

a
b
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Search for folders with specified number of subfolders

Post by *Stefan2 »

rqqt wrote:...
I'm trying to find directories with more than X number of subdirectories.

...

Is it possible to just show the top-most folder?
I didn't understood, but see the drop-down menu "Search in subdirectories: All"





 
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2rqqt
May I suggest that you make a Custom column with this fleld content: [=dirsizecalc.Directory Count] - then you can sort by this column
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Post by *tuska »

Using Everything makes this solution possible.

1. ALT+SHIFT+F7 Find in separate process in TC
2. Field "Search for:" ev:childfoldercount:3    -> Everything Functions ...
    childfoldercount:<count> ... Search for folders that contain the specified number of subfolders.
3. Field "Search in:" is ignored with parameter ev:
4. 'Everything' ... must be ticked!
5. Click on "Start search..."
6. Click on "Feed to listbox"

In such a case, I would recommend the following:

Custom columns view
Configuration > Options... > Custom columns > New > Name: e.g. File name and path > Add column > click on the "+"-plus sign
choose plugin: tc > click in field "Filter:" enter path, OK > add Caption: Path --> Field contents: [=tc.path]
tick "Adjust Tabs to window width" and "Horizontal scrollbar" > OK

View Mode
Configuration > Options... > View Mode > Add: e.g. Search >
Columns view: choose "File name and path" with dropdown arrow (= name of your Custom columns view) > OK
View Mode <Default> - Attention: Here you should make settings in case a view mode is ended.
E.g. Columns view: Full, Sort order: Name

Auto Switch Mode
Configuration > Options... > Auto Switch Mode >
Tick "Automatically switch view mode on directory change:" > Add...: Rule (use dropdown arrow) = S: Search result >
Set this mode: (use dropdown arrow) = Search (= name of your View Mode) > OK

The result is the names of the top-most folders which contain 3 subdirectories and the path of the top-most folders.

Button
A button with command: cm_SrcViewMode0 allows the standard/default view to be restored at any time.
Post Reply