How to search through multiple directories and list folders that don't contain a specific file type?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
mkrsticch
Junior Member
Junior Member
Posts: 4
Joined: 2023-08-20, 09:06 UTC

How to search through multiple directories and list folders that don't contain a specific file type?

Post by *mkrsticch »

How to search through multiple directories and list folders that don't contain a specific file type?

Is there a plugin to find folders that don't contain files with a specific extension or I can achieve this using regular expressions?
hi5
Power Member
Power Member
Posts: 637
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: How to search through multiple directories and list folders that don't contain a specific file type?

Post by *hi5 »

You can use |, so to find all folders that don't have any png files in them

Code: Select all

|*.png
Open the search and press F1 or the help button for some more examples with |
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
User avatar
tuska
Power Member
Power Member
Posts: 4049
Joined: 2007-05-21, 12:17 UTC

Re: How to search through multiple directories and list folders that don't contain a specific file type?

Post by *tuska »

For example, when using the 'Everything' tool, the search in Total Commander is as follows --> field "Search for":

Code: Select all

ev:folder: !child:*.jpg
Explanation:

Code: Select all

*.jpg = Specific file type
ev: 	Total Commander parameter, to be able to use the parameters of tool 'Everything' in Total Commander. 
folder: Modifier, match folders only.
!	NOT
child:  https://www.voidtools.com/forum/viewtopic.php?f=12&t=10176#child

Windows 11 Pro (x64) Version 22H2 (OS build Build 22621.2134)
TC 11.00 x64/x86 | Search queries: TC <=> 'Everything'
'Everything' 1.5.0.1355a (x64) | 'Everything' 1.4.1.1024 (x64)
User avatar
Dalai
Power Member
Power Member
Posts: 9963
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: How to search through multiple directories and list folders that don't contain a specific file type?

Post by *Dalai »

You can use FileInDir with its field DirFiles.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
mkrsticch
Junior Member
Junior Member
Posts: 4
Joined: 2023-08-20, 09:06 UTC

Re: How to search through multiple directories and list folders that don't contain a specific file type?

Post by *mkrsticch »

Here's the situation:

I have a directory path: c:\temp\, which contains 5 subfolders named dir1, dir2, dir3, dir4, and dir5. Among these subfolders, I've placed some PNG files only in dir1, dir3, and dir5, while dir2 and dir4 remain empty.

When I utilize the native Total Commander search query *.png to find all folders containing PNG files, the search results are as expected:

[3 files and 0 directories found]
c:\temp\dir1\001.png
c:\temp\dir3\003.png
c:\temp\dir5\005.png


However, the challenge arises when I attempt a search query |*.png to list folders that do not have any PNG files inside. The search results I get are quite different from what I anticipated:

[0 files and 5 directories found]
[c:\temp\dir1]
[c:\temp\dir2]
[c:\temp\dir3]
[c:\temp\dir4]
[c:\temp\dir5]


This outcome isn't aligned with my expectations. Ideally, I should have received:

[0 files and 2 directories found]
[c:\temp\dir2]
[c:\temp\dir4]


As you can see, my goal is to identify folders that lack a specific file type using Total Commander's native search query or possibly a plugin such as FileInDir or tc plugin.

Thank you in advance for taking the time to read my query and offer your valuable advice.
User avatar
Dalai
Power Member
Power Member
Posts: 9963
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: How to search through multiple directories and list folders that don't contain a specific file type?

Post by *Dalai »

As I said: It should work with the FileInDir plugin set to

Code: Select all

fileindir | DirFiles | !contains | .png
Note that wildcards should be omitted here. You might want to adapt the search term to your needs, e.g. leaving the leading dot out, maybe change the operator to regex or similar.

[EDIT]
Operator changed from != to !contains.
[/EDIT]

Regards
Dalai
Last edited by Dalai on 2023-08-20, 15:04 UTC, edited 1 time in total.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
tuska
Power Member
Power Member
Posts: 4049
Joined: 2007-05-21, 12:17 UTC

Re: How to search through multiple directories and list folders that don't contain a specific file type?

Post by *tuska »

Alt+Shift+F7: Find Files (separate) > Tab "Plugins"

Code: Select all

☑️ Search in plugins    ◉ OR (any match)   <-- !!

Plugin:   fileindir
Property: DirFiles
OP:	  !contains
Value:	  .png (and NOT *.png!)

Click on button "More rules" ...

Plugin:   filex
Property: EmptyDir
OP:	  =
Value:	  Yes
Click on button "Start search".


Plugin "FileInDir 2.0.0.2" | Plugin "FileX" - Download FileX23.zip
A double click in Total Commander(!) on the .zip file starts the plugin installation...
mkrsticch
Junior Member
Junior Member
Posts: 4
Joined: 2023-08-20, 09:06 UTC

Re: How to search through multiple directories and list folders that don't contain a specific file type?

Post by *mkrsticch »

Code: Select all

☑️ Search in plugins    ◉ OR (any match)   <-- !!

Plugin:   fileindir
Property: DirFiles
OP:	  !contains
Value:	  .png (and NOT *.png!)

Click on button "More rules" ...

Plugin:   filex
Property: EmptyDir
OP:	  =
Value:	  Yes
Thanks tuska, it works for me!
User avatar
tuska
Power Member
Power Member
Posts: 4049
Joined: 2007-05-21, 12:17 UTC

Re: How to search through multiple directories and list folders that don't contain a specific file type?

Post by *tuska »

mkrsticch wrote: 2023-08-20, 15:49 UTC Thanks tuska, it works for me!
I'm pleased. :)

Thanks to Dalai for pointing out the plugin "FileInDir".
mkrsticch
Junior Member
Junior Member
Posts: 4
Joined: 2023-08-20, 09:06 UTC

Re: How to search through multiple directories and list folders that don't contain a specific file type?

Post by *mkrsticch »

Code: Select all

☑️ Search in plugins ◉ AND (all match)

Plugin: tc
Property: ext
OP: !contains
Value: png

"More rules" ...

Plugin: filex
Property: EmptyDir
OP: =
Value: Yes
The plugin combination above also does a job. :wink:

Thank you all for your help!
Post Reply