Menu Close

How to list folder sizes in Windows

Here are few methods:

1. CMD command:
Open CMD. Go to the directory in question (cd C:\Directory) and type the below:

dir /c /s > c:\dirlist.txt

The example above will dump all f the data in a text file called dirlist.txt in c. If you would like that file to be generated somewhere else just change the path (ie D:\MyFolder\dirlist.txt).

2. Powershell command:
Open CMD. Go to the directory in question (cd C:\Directory) and type the below:

powershell -command “$fso = new-object -com Scripting.FileSystemObject; gci -Directory | select @{l=’Size’; e={$fso.GetFolder($_.FullName).Size}},FullName | sort Size -Descending | ft @{l=’Size [MB]’; e={‘{0:N2} ‘ -f ($_.Size / 1MB)}},FullName”