I'd go for TreeSize Free as well - it shows number of files and sizes for all/any directory or sub-directory you choose. If you wanted though you could do it using the PowerShell Get-ChildItem command1 - How can I discover on the root drive the total of folders and files on drive?
2 - Better, how could I list the number of files within each folder?
These are pretty much the same - just change the drive and say if you want files or directories...Code:
(Get-ChildItem "C:" -Recurse -Directory| Measure-Object | %{$_.Count}) | format-table (Get-ChildItem "C:" -Recurse -File| Measure-Object | %{$_.Count}) | format-table
3 - Even better, how could I list the total of subfolders and files at each level within the tree branches?
You could combine the 2 above and make a little loop... Note that if you look at the root of C: there are 20000+ sub-directories so it might be a little useless as information (too much of it) although you could output it to excel I suppose..
Anyway if you narrow the starting directory it might be useful.Code:
$StartDir = Get-ChildItem "D:Drivers" -Directory -Recurse | Select -Expandproperty FullName Function New-ReportLine ($Directory,$SubDirectories,$Files) { New-Object -TypeName psObject -Property @{Directory=$Directory; SubDirectories=$SubDirectories; Files=$Files} } $report = $StartDir | ForEach-Object { $SubDirectories = (Get-ChildItem -Directory -Path $_ | Measure-Object | %{$_.Count}) $Files = (Get-ChildItem -File -Path $_ | Measure-Object | %{$_.Count}) New-ReportLine -Directory $_ -SubDirectories $SubDirectories -Files $Files } $report | Format-Table Directory,SubDirectories,Files –AutoSize
Gives an output likeCode:
PS C:Windowssystem32> C:UsersHaliDesktopUntitled1.ps1 Directory SubDirectories Files --- ------ --- D:DriversDisk 0 0 D:DriversNetwork 2 0 D:DriversUSB 0 0 D:DriversNetworkVEN_14E4_DEV_16A3 1 4 D:DriversNetworkVEN_14E4_DEV_4331 0 9 D:DriversNetworkVEN_14E4_DEV_16A3amd64 0 1