Windows 10: showing the total of folders/files in drive root

  1.    04 Sep 2016 #1

    showing the total of folders/files in drive root


    Properties are shown differently for folders and roots.
    Root properties only shows used and free space.
    Folder properties shows Size, Size on Disk, number of files/folders.
    Questions:
    1 - 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?
    3 - Even better, how could I list the total of subfolders and files at each level within the tree branches?
      My ComputerSystem Spec


  2. Posts : 15
    Windows 10/OS X 10.11 ADP
       04 Sep 2016 #2

    You would be asking for a drive graphing program. There are numerous. I'm not completely certain of what you mean, but I believe it would come under one of two programs.

    WinDirStat is most peoples first port of call. TreeSize Free will show you the total number of files. I believe the latter has a 30 day trial of it's premium software that would be able to save all kinds of data about your drive to a file.

    WinDirStat - Windows Directory Statistics
    TreeSize Free - Quickly Scan Directory Sizes and Find Space Hogs
    Hope this helps.
      My ComputerSystem Spec

  3.    04 Sep 2016 #3

    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 command
    gypsycomp said: View Post
    1 - 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

    gypsycomp said: View Post
    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 like
    Code:
    PS C:\Windows\system32> C:\Users\Hali\Desktop\Untitled1.ps1
    
    Directory                                  SubDirectories Files
    ---------                                  -------------- -----
    D:\Drivers\Disk                                         0     0
    D:\Drivers\Network                                      2     0
    D:\Drivers\USB                                          0     0
    D:\Drivers\Network\VEN_14E4_DEV_16A3                    1     4
    D:\Drivers\Network\VEN_14E4_DEV_4331                    0     9
    D:\Drivers\Network\VEN_14E4_DEV_16A3\amd64              0     1
      My ComputerSystem Spec


 

Related Threads
Still Cannot Access Root Drive ( C:\ ) in User Accounts and Family Safety
I need to copy a file into my Windows 10 root drive (C:\). I cannot and get Error 0x80070522. - Found a tool which I really don't want to use since it is for folders and sub-folders. - Turned off User Account Control setting is set to the lowest....
$xxx Folders in Root of C: in General Support
I was under the impression that these folders would go away or can be deleted, BUT !! Has been some time from 1511 build was installed. C:\ $Windows -W " - BT C:\ $sysreset Still have .log and .xml from 12/26/2015 in...
I have about 100 files that start with the { character and end with the } character. Inside these two characters are a series of numbers and letters. The file sizes vary from 2-3K. Some of the earliest files are from 2012 and were from prior Windows...
Hello, I have this issue where the files and folders on an external device (such as an external HDD and USB) are not showing up, yet the device is visible. I only started getting this issue after I connected my USB to another computer which makes me...
Hi all, first post, so I hope I'm posting in the right place. I have decided to migrate to Win10 while maintaining my Win7 system until I'm sure (on the same box). Win 10 is installed on a new SSD, Win7 on an old SSD, with all my files held on a...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:38.
Find Us