Using Sysinternals Disk Usage to create CSV file of Folder Sizes

Windows Sysinternals Suite has a bunch of really useful tools to make any system admin's life easier. One of those tools is Disk Usage, DU.exe. One can utilize DU to get a breakdown of folders and sizes. Anyone who was trying to find out what's utilizing all their storage knows how important this utility can be. Below is how to utilize DU as well as print the findings to a CSV file.

These are the standard instructions...

Using Disk Usage (DU)

Usage: du [-c[t]] [-l <levels> | -n | -v] [-u] [-q] <directory>

-c Print output as CSV. Use -ct for tab delimiting.
-l Specify subdirectory depth of information (default is all levels).
-n Do not recurse.
-v Show size (in KB) of intermediate directories.
-u Count each instance of a hardlinked file.
-q Quiet (no banner).

Example: Open command prompt and type:

du -c -l 2 c:\

Above will result in showing the directories and sizes for two levels from C. Meaning the top directory and all subdirectories. This helps but what if you want to send the information to a file instead of seeing them in the command prompt? Here's an example...

du -c -l 2 c:\>c:\Size_C_dir_2levels.csv

Using the ">c:\Size_C_dir_2levels.csv" tells the output to be written to the CSV file since the > character is present.

I can be reached for comments, questions or ideas on twitter @Try2StopUs

Try2Stop.Us | Contact Us | Log In | Try2Stop.Us © 2011