1.    04 Sep 2016 #1
    Join Date : Jul 2016
    Posts : 6
    win10

    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.    04 Sep 2016 #2
    Join Date : Sep 2016
    Posts : 15
    Windows 10/OS X 10.11 ADP

    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
    Join Date : Jul 2015
    Posts : 3,655
    10 Pro

    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
    Quote Originally Posted by gypsycomp 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

    Quote Originally Posted by gypsycomp 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

 


Similar Threads
Thread Forum
Still Cannot Access Root Drive ( C:\ )
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....
User Accounts and Family Safety
$xxx Folders in Root of C:
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...
General Support
{} Files in Windows Root Folder
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...
General Support
Solved Files and Folders Not Showing on External Devices
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...
Drivers and Hardware
Old versions of files and folders on 2nd drive
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...
General Support
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 14:47.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums