Server Fault is a question and answer site for system and network administrators. 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

I need a command (like "dir") that lists all directories with their size. I need just a 1 level deepness but with the total size of a directory.

For example

>dirsize c:/mainfolder
    subfolder1  15640
    subfolder2 682310
    subfolder3 283550
share|improve this question
up vote 1 down vote accepted

Use diruse from the Support Tools:

diruse /* c:\mainfolder

or du from Sysinternals:

du -l 1 -q c:\mainfolder
share|improve this answer

Paste the following into a file in the parent directory named getdirsize.bat

@echo off
set /a val=0
set /a tot=0
for /R %1 %%i in (*) do (
set /a val=%%i
set /a tot=!tot!+!val!
@echo %cd%:!tot! 

Then run the command below from the parent directory. Alternatively, you could install the GNU coreutils for Windows and substitute du for getdirsize.bat below. I'm currently on a Linux system so can't test -- you may need to tweak this a little.

for /D %subdirs in (.*) do getdirsize.bat %subdirs

share|improve this answer

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.