Search feature - show only directories contains files

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
dzyszla
Junior Member
Junior Member
Posts: 4
Joined: 2024-04-10, 05:59 UTC

Search feature - show only directories contains files

Post by *dzyszla »

Hi,

I'd like to see the feature in search files module, that outputs only unique directories contains one or more files found.
Why? For example I search for some projects (each in separate directory) contains some name, solution or something. I no need exact file, because I must open whole project. So I need only directory name.

That search can be faster (only first file in each directory enough) and results more compact and useful in this case.
User avatar
Gral
Power Member
Power Member
Posts: 1467
Joined: 2005-01-26, 15:12 UTC

Re: Search feature - show only directories contains files

Post by *Gral »

Already possible with DirSizeCalc content plugin - https://totalcmd.net/plugring/dirsizecalc.html
dzyszla
Junior Member
Junior Member
Posts: 4
Joined: 2024-04-10, 05:59 UTC

Re: Search feature - show only directories contains files

Post by *dzyszla »

However, locating the first file that meets the search criteria without any other features can be more efficient. I think this feature isn't too complicated - just ignore file name and break searching in current directory after found first file and go to next directory.
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1013
Joined: 2004-07-29, 11:00 UTC

Re: Search feature - show only directories contains files

Post by *ZoSTeR »

 
You could try the "EmptyDir" or "ZeroSizeDir" attribute from FileX in your search and user columns.

Alternatively you could install "Everything" and set "Calculate space occupied by subdirectories" to "Always, only with Everthing" in the TC settings.
dzyszla
Junior Member
Junior Member
Posts: 4
Joined: 2024-04-10, 05:59 UTC

Re: Search feature - show only directories contains files

Post by *dzyszla »

But dir isn't empty.

Maybe for example I have:

Dir1\DirA\File1.txt -> abc
Dir1\DirA\File2.txt -> xtb
Dir1\DirA\File3.txt -> uvy
Dir1\DirB\File1.txt -> xyz
Dir1\DirB\File2.txt -> ert
Dir2\File1.txt -> abracadabra
Dir2\File2.txt -> aux

Now: search for *.txt contains 'b'; results I want:
Dir1\DirA
Dir2

How search can work:
cd Dir1
cd DirA
find 'b' in File1.txt -> Result: true; Add to result list: Dir1\DirA
break;
cd ..\DirB
find 'b' in File1.txt -> Result: false
find 'b' in File2.txt -> Result: false
cd ..
cd ..
cd Dir2
find 'b' in File1.txt -> Result: true; Add to result list: Dir2
break;

----

Now, If in Dir1/DirA have a 200 files, and 100 of its contains 'b', search no need exams everyone file, but - in worst case - only 101 (in best: only 1).

If I use regular expression for search and have a 1 000 files in each of 1 000 folders my proposed solution make different in searching speed, if I need only folders contains files contains some text. No need to touch every of 1 000 000 files.
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Search feature - show only directories contains files

Post by *tuska »

dzyszla wrote: 2024-04-18, 10:02 UTC Maybe for example I have:

Dir1\DirA\File1.txt -> abc
Dir1\DirA\File2.txt -> xtb
Dir1\DirA\File3.txt -> uvy
Dir1\DirB\File1.txt -> xyz
Dir1\DirB\File2.txt -> ert
Dir2\File1.txt -> abracadabra
Dir2\File2.txt -> aux

Now: search for *.txt contains 'b'; results I want:
Dir1\DirA
Dir2
2dzyszla
It's not exactly what you want, but maybe it will help you a little: Picture
If you are interested, please test it(!).

Search query in Total Commander (search results almost in real time *) using 'Everything' parameters:
* Everything Options > Content > ☑️ Index file content > Include only files: *.txt ... required!

Code: Select all

ev:D:\Dir1\ | D:\Dir2\ ext:txt content:b !UNIQUE:

Windows 11 Pro (x64) Version 23H2 (OS Build 22631.3447)
TC 11.03 x64/x86 | 'Everything' 1.5.0.1372a (x64)
Search queries: Total Commander <=> 'Everything' <= Windows Search
Troubleshooting | Troubleshooting Information 1.5
dzyszla
Junior Member
Junior Member
Posts: 4
Joined: 2024-04-10, 05:59 UTC

Re: Search feature - show only directories contains files

Post by *dzyszla »

tuska wrote: 2024-04-18, 15:11 UTC 2dzyszla
It's not exactly what you want, but maybe it will help you a little: Picture
If you are interested, please test it(!).

Search query in Total Commander (search results almost in real time *) using 'Everything' parameters:
* Everything Options > Content > ☑️ Index file content > Include only files: *.txt ... required!

Code: Select all

ev:D:\Dir1\ | D:\Dir2\ ext:txt content:b !UNIQUE:
Thanks! It's smart solution but a little bit complicated :) I think can to use it for now. But maybe in the future TC will get this function natively? :) I think it's simple to implement.
Post Reply