DiskUsage – The new Windows 10 Command Line Tool

0

Linux has du, a standard command-line that allows a user to check the disk usage information quickly. To fill the gap in Windows, Sysinternals provides a similar command-line tool, du, that reports the disk usage for the directory you specify.

Now Windows is going to have a native one shortly in the future. DiskUsage is an up-coming command-line in Windows that checks and summarize disk usage recursively for the giving directory.

To use the command line, open an elevated command prompt or PowerShell window and type the following command.

DiskUsage [Options] [Directory]

For example, to find all files that are larger than 1GB in my windows folder.

DiskUsage /f=1024000000 c:\windows
image 12 600x311 - DiskUsage - The new Windows 10 Command Line Tool

There is also a switch /h to display sizes in human-readable format rounded to gigabytes, as well a switch /c as /csv to display the result in CSV format.

And at the end of the result, DiskUsage always provides used vs total size with a percentage of how much disk space in use.

To find the full usage of the command line, use /?.

C:\WINDOWS\system32>DiskUsage /?
DiskUsage - Disk Usage
Description: Summarize disk usage recursively for the given directory.
Usage : diskusage [Options] [Directory]
Options :
/a, /systemAndReserve displays size for system files and reserved space
/c, /csv displays in csv format
/d, /maxDepth=N displays directory information only if it is N or
fewer levels below command line argument
/e, /minFileSize=SIZE displays directory information only if its FileSize
is greater or equal than SIZE
/f, /minSizeOnDisk=SIZE displays directory information only if its SizeOnDisk
is greater or equal than SIZE
/g, /displayFlag=FLAG specifies the flags value to determin which column(s) to display
column value description
SizeOnDisk 0x001 the on disk size
FileSize 0x002 the end of file size
SizePerDir 0x004 sum of SizeOnDisk for top level child
Files 0x008 number of child files
ChildDirs 0x010 number of child directories
FilesPerDir 0x020 number of top level child files
DirsPerDir 0x040 number of top level child directories
CreationTime 0x080 file creation timestamp
LastAccessTime 0x100 file last access timestamp
LastWriteTime 0x200 file last write timestamp
Attributes 0x400 file attributes
/h, /humanReadable displays size in human readable format
/i, /iniFile=FILE takes all the parameters from an INI file.
NOTE: SCENARIO name must be speificed via /j (/scenario)
/j, /secnario=SCENARIO specifies the scenario name for the INI file
/l, /allLinks count all hardlinks separately (By default, files with multiple
hardlinks are counted only once towards the first link name)
/m, /multipleName count only files with more than one link names
/n, /nameFilter=FILTER count only files whose name matches the name filter
/p, /preferredPath=PATH count files with multiple link names towards the first link that's
under PATH if it exists
NOTE: This options must not be specified togerther
with /l (/allLinks)
/q, /virtual recurse into virtual directories
/r, /skipReparse skip recursing into reparse directories
/s, /skipResurse skip recursing into child directories when calculating sizes
/t, /TopDirectory=N displays Top N directories by SizeOnDisk in descending order
/u, /TopFile=N displays Top N files by SizeOnDisk in descending order
/v, /verbose displays verbose error information
/x, /clearDefault do not display the default selected columns

DiskUsage is only available in Windows Insider builds, 21277 and above. So it’s still a work-in-progress product that will come around later.

LEAVE A REPLY

Please enter your comment!
Please enter your name here