search for folders that contain 3 or more files with the same extension
Moderators: Hacker, petermad, Stefan2, white
search for folders that contain 3 or more files with the same extension
Hi to everyone.
There's a way in Total Commander to search folders that contain 3 (or more) files with the same extension?
for example I want to search for all folders that have at least 3 .flac files
thanx in advance
There's a way in Total Commander to search folders that contain 3 (or more) files with the same extension?
for example I want to search for all folders that have at least 3 .flac files
thanx in advance
Re: search for folders that contain 3 or more files with the same extension
rockberto wrote: 2024-07-17, 21:58 UTC search folders that contain 3 (or more) files with the same extension?
for example I want to search for all folders that have at least 3 .flac files
Not with TC alone.
I took a look and came up with this:
Open a PowerShell console in the "main"-folder.
Try something like this:
Instead, better see below the post by NotNull
gci -dir -rec | ?{$_.GetFiles('*.flac').Count -gt 2} | select -exp FullName | Set-Content C:\Temp\_myLoadlist.txt
my code deleted
$FOLDERS = Get-ChildItem d:\directory | ?{$_.PSISContainer}
or
$FOLDERS = GCI -Recurse | ?{$_.PSISContainer} # the current folder
Next paste in:
Code: Select all
$OUT=''
ForEach ($FLD in $FOLDERS){
Set-Location $FLD.FullName
"`n`nDEBUG FOLDER: $($FLD.FullName) "
GCI -File | Group -Property Extension |
Select-Object Name, Count |
ForEach{if ($_.Name -eq '.flac' -AND $_.Count -gt 2){"YES"; $OUT+=$($FLD.FullName)+"`r`n"}}
}
"`n`nRESULT:`n$OUT"
EXPORT the result to a text file:
$OUT | Set-Content C:\Temp\_myLoadlist.txt
[/color]
Next use TC's LOADLIST to load that list of folders into TC.
For more details about this LOADLIST see:
viewtopic.php?p=457717#p457717 (Search folders that contain txt files that contains a specific word)
Re: search for folders that contain 3 or more files with the same extension
2rockberto
As I just learned today, you can use the FileMask plugin http://www.mgpsoft.net/Downloads/FileMask.zip for such a task.
You will have to add the extension you want to search for to the [DirMask] section of the FileMask.ini file in the plugin folder - like this:
You can then use the Plugins tab in TC's Find Files dialog:
Plugin: filemask
Property: DirMask
OP: >=
Value: 3 [Flac]
Leave the "Search for:" field blank in the General tab.
As I just learned today, you can use the FileMask plugin http://www.mgpsoft.net/Downloads/FileMask.zip for such a task.
You will have to add the extension you want to search for to the [DirMask] section of the FileMask.ini file in the plugin folder - like this:
Code: Select all
[DirMask]
Flac=*.flac
Plugin: filemask
Property: DirMask
OP: >=
Value: 3 [Flac]
Leave the "Search for:" field blank in the General tab.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: search for folders that contain 3 or more files with the same extension
Do you have Everything 1.5 installed and configured to work with Total Commander?
In that case, search for
It will list all folders below the active folder that contain 3 or more .flac files.
(can't test it atm, but should work)
In that case, search for
Code: Select all
ed: child:*.flac child-occurrence-count:>2
(can't test it atm, but should work)
Alternative:
Code: Select all
gci -Directory -Recurse | Where { $_.GetFiles('*.flac').Count -gt 2 } | select FullName
Re: search for folders that contain 3 or more files with the same extension
I found it only here. Why doesn't the author update the options in the help?
Overquoting is evil! 👎
Re: search for folders that contain 3 or more files with the same extension
WOWNotNull wrote: 2024-07-21, 19:53 UTC Alternative:Code: Select all
gci -Directory -Recurse | Where { $_.GetFiles('*.flac').Count -gt 2 } | select FullName

That's not an alternative, but the real way of doing this task.
I never noticed that "GetFiles"
Works fine
1)
gci -dir -rec | ?{$_.GetFiles('*.TxT').Count -gt 2} | select -exp FullName | Set-Content C:\Temp\_myLoadlist.txt
2)
use TCs LOADLIST
LOADLIST C:\Temp\_myLoadlist.txt
and then Ctrl+T to double the search result
Re: search for folders that contain 3 or more files with the same extension
Just sharing .. found out about it a couple of weeks ago, so you're not alone in that

Re: search for folders that contain 3 or more files with the same extension
sorry for the delay in replying. We have had a busy period and I have not been able to use the computer. In the meantime, thanks for your answers, tomorrow we will be back up and running and I will do all the tests with your suggestions. Thanks!