K
K
Konstantin Tsvetkov2022-01-16 10:05:54
Windows
Konstantin Tsvetkov, 2022-01-16 10:05:54

How to get a list of folders sorted by the number of files?

How to get a list of folders sorted by the number of files in it?
Means: either Explorer, or a file manager (which one?), Or command line, or a special program.
Time: Unlimited within reason.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MaxKozlov, 2022-01-17
@tsklab

Again Powershell:

$folders = Get-ChildItem -Path C:\  -Directory -Recurse | ForEach-Object {
  [PSCustomObject]@{
    Path=$_.FullName
    Count=$_.FullName | Get-ChildItem -File | Measure-Object | Select-Object -ExpandProperty Count
  }
} | Sort-Object Count -Descending
# Посмотреть потом первый десяток:
$folders | Select -First 10

You can, by the way, merge with another question, but most likely there will be duplicates due to repeated accesses to the same folder, too lazy to check :)
But all this is extremely slow.
If it's just to evaluate something, it's better to take WizTree https://diskanalyzer.com/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question