Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

du.exe lets you recursively identify folders that take up a large amount of space. For example, the following will show you the size of all the folders from c:\ 3-levels deep:

du.exe -l 3 c:\

How can I filter this output to only show me the folders above 1GB?

Here's an extract of the output from du.exe for reference:

Du v1.4 - report directory disk usage
Copyright (C) 2005-2011 Mark Russinovich
Sysinternals -

   6,344,864  c:\Windows\winsxs
  18,268,671  c:\Windows
 483,343,308  c:\
Files:        412125
Directories:  42072
Size:         494,943,548,281 bytes
Size on disk: 487,560,269,896 bytes
share|improve this question
up vote 6 down vote accepted

As the other answer says, you can't do it with du.exe alone. PowerShell to the rescue!

.\du.exe -c -l 3 C:\ | ConvertFrom-Csv -Header Size,Path | Where-Object { [int]$_.Size -gt 1048576 } | Sort-Object { [int]$_.Size } -descending


Breaking that long command down into the individual bits that are each piped into the next one:

.\du.exe -c -l 3 C:\

This is basically what you started with, except the -c parameter tells du to format the output as CSV.

ConvertFrom-Csv -Header Size,Path

This takes the CSV output from du and converts it into a PowerShell hashtable. Since du doesn't provide a header with column names, that has to be done manually.

Where-Object { [int]$_.Size -gt 1048576 }

This filters the data, returning only those rows where the size is greater than 1 GB (du returns sizes in KB, and 1 GB = 1048576 KB). Note the [int] part, to let PowerShell know that it's dealing with numeric data.

Sort-Object { [int]$_.Size } -descending

This sorts the data by size, in descending order (again specifying that the data to sort by is numeric). This is optional, of course.

share|improve this answer
Thanks Indrek - this worked great! – Iain May 5 '12 at 18:02

In the latest du.exe version appending a header with Powershell ConvertFrom-Csv doesn't work out of the box, because du.exe appends it's own header in the listing. What we need to do is select the existing header with select command.

du.exe -c -l 3 C:\ | ConvertFrom-Csv | select Path,DirectorySize | Where-Object { [int]$_.DirectorySize -gt 1048576 }
share|improve this answer

That options isn't available with DU 1.4

Usage: du [-c] [-l (levels) | -n | -v] [-u] [-q] (directory)

-c Print output as CSV.

-l Specify subdirectory depth of information (default is all levels).

-n Do not recurse.

-q Quiet (no banner).

-u Count each instance of a hardlinked file.

-v Show size (in KB) of intermediate directories.

So just using DU can't limit the output to something of a specific size.

share|improve this answer
Happy to combine with other tools available on the command line. – Iain May 5 '12 at 17:55
Then there you go. Indrek has the answer you want. I gave it a +1. – Bon Gart May 5 '12 at 17:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.