Sysinternals Du

This post covers the Sysinternals tool Du – Directory disk usage reporter. It is the second post in a series covering the Sysinternals suite of tools to help people discover new ones they may not have used before.

What is Directory disk usage reporter?

Directory disk usage reporter will be very familiar to those who have used Unix/Linux based operating systems. It is basically the equivalent of the du command on those platforms and provides information on the size of a given directory. If you want to know which directories contain the data filling a drive this tool can be most useful – if you’ve used the ‘TreeSize’ program consider Du to be a CLI equivalent. Quite often my team is asked to explain why a system is running low or out of disk space and having an effective tool to assist in this process is vital.

What information does it present and how do I use it?

Running du.exe from the command line by default will list the number of files, directories and size for a given target path having iterated recursively through that path.

As an example, below I execute the command and provide a drive path to examine.

We can view the available command options by simply running du, the help output will display without the need for /? or -? however if you do add these they will bring up the help as expected.

To avoid seeing the Sysinternals Du banner every time the command runs you can use the -q Quiet switch. Note the command syntax expects the switch to come before the directory path. Entering the -q switch after the directory will result in nothing being displayed.

This demonstrates the importance of knowing the command syntax – du expects all switches to come before the directory path. The Sysinternals documentation provides the following as a reference for the command syntax.

  • du [-c[t]] [-n | -l levels | -v] [-u] [-q] directory

Note that you cannot use -n-l or -v together, they are considered to be mutually exclusive which makes sense when you consider what the switches do.

The program works quite happily on mapped drives as shown below. I use the -q switch to suppress the banner and -v to “Show size (in KB) of all subdirectories” –

The -l switch can be used to determine how many levels deep directory usage is reported on. Let me use the following two command run outputs to demonstrate what I mean by this. First off I will run the command with only two switches, -q to suppress the banner and -v to show the size of subdirectories.

As you can see the command output iterates through the entire directory tree reporting on each level. Now I will run the same command again but with the -l switch and a value of 1 to only display the information for one directory level deep.


Now I want to cover my favourite options which allow us to export the returned data as either a comma-separated value (CSV) or tab-delimited. This is where things get really powerful and provide a way to take a large output and manipulate it in another program such as Microsoft Excel.

The required switch is -c which will produce a CSV format or -ct which produces tab-delimited. If we just run the command with the relevant switches it will output the data to the command window, this is OK for the small example directory I use in my example below but for larger runs we will want to re-direct this to either the clipboard or a file.

Let’s run the same command again twice – once with the output going to the clipboard and then to a file.

Output to clipboard –

Output to a file –

Du output to text file

We can import this into Excel (or paste from the clipboard using the text import wizard), once the data is in Excel we can manipulate it and create graphs if desired.

Du Ouput In Microsoft Excel

Du Ouput Graph


I hope you can see just how powerful this tool can be in helping you understand where disk space is being consumed within a directory structure. With the right setup this can also be automated as a scheduled task that creates an output file which can then be e-mailed or dropped somewhere appropriate for end users/technicians to review and assist them in tidying up their drives. I know that we have been able to avoid allocating more SAN storage to various customers by simply demonstrating that their drives were full of junk that once deleted negated the need for any additional storage.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.