showing the total of folders/files in drive root


  1. Posts : 8
    win10
       #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 Computer


  2. Posts : 15
    Windows 10/OS X 10.11 ADP
       #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 Computer


  3. Posts : 5,478
    2004
       #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:
    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:
    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 Computer


 

  Related Discussions
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 17:02.
Find Us




Windows 10 Forums