Display folders with less than 3 files

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
fnheiden
Senior Member
Senior Member
Posts: 234
Joined: 2003-02-16, 12:06 UTC
Location: Dresden, Germany
Contact:

Display folders with less than 3 files

Post by *fnheiden »

I know, that this question is a little bit off-topic, but as I know that you're all in file managing I may ask it here:

Does anyone know a program (or a hidden TC command ;)) which displays folders within a directory tree which contain less than a given number of files?

Thanks in advance for any feedback!
~ Florian
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

No I don't, but since you are a programmer, you could write it yourself in half an hour, right? :)
Author of Total Commander
https://www.ghisler.com
User avatar
fnheiden
Senior Member
Senior Member
Posts: 234
Joined: 2003-02-16, 12:06 UTC
Location: Dresden, Germany
Contact:

Post by *fnheiden »

ghisler(Author) wrote:No I don't, but since you are a programmer, you could write it yourself in half an hour, right? :)
Right :)

~ Florian
User avatar
jdmarch
Member
Member
Posts: 161
Joined: 2003-03-12, 02:34 UTC
Location: Austin, Texas, USA

Post by *jdmarch »

This is the sort of task for which the advanced commands (on the comand line or in batch files or aliases) in JPSoftware's Take Command 32 or 4NT are perfect. The following 1-line command will output the names of (and number of files in) any subfolder (at any level), which contains fewer than 20 files. (this could be edited to count only files meeting wildcard or attribute requirements):

Code: Select all

global /i /q if %@files[*] LT 20 echo %_cwd %@files[*]
Or for a more general solution you could define the alias:

Code: Select all

alias fewfiles=global /i /q if %%@files[%%1] LT %%2 echo %%_cwd %%@files[%%1]
and then invoke it like:

Code: Select all

fewfiles * 20
fewfiles *.doc 15
If you prefered you could list (or save to a file) all the filenames in these "small" folders, etc, etc...

You can download a full-featured 30-day trial version from:
http://jpsoftware.com
User avatar
fnheiden
Senior Member
Senior Member
Posts: 234
Joined: 2003-02-16, 12:06 UTC
Location: Dresden, Germany
Contact:

Post by *fnheiden »

jdmarch,
Thank yor very much! It works very well :)

With best regards,
~ Florian
Post Reply