A batch file that returns the size of a folder

I am having space problems on my Vista machine and need to figure out what takes up so much space.

I would like to write a simple batch file that returns all folders under C: and the size of each folder.

The dir command does not return the size of the folder.

Unfortunately, we do not have administrator rights and it is impossible to install a third-party application, and we have other users in our group who also need this information.

+7
source share
2 answers

I would look at this thread for some tips on how to achieve directory size:

Batch file to display directory size

Otherwise:

DirSize:

 @echo off setLocal EnableDelayedExpansion set /a value=0 set /a sum=0 FOR /R %1 %%I IN (*) DO ( set /a value=%%~zI/1024 set /a sum=!sum!+!value! ) @echo %CD%:!sum! k 

AllDirSize:

 echo off set WORKING_DIRECTORY=%cd% for /f "delims=" %%a in ('dir /a:D /D /B /S') do ( echo off cd %%a "%WORKING_DIRECTORY%"\dirsize "%%a" cd %WORKING_DIRECTORY% ) 

Use it: ALLDIRSIZE > C:\temp\FileContainingFolderSizes.txt

What is taken from Richard Bishop's excellent testing forums: http://www.bish.co.uk/forum/index.php?topic=58.0

+7
source

By directly answering your question, but if you have access to the GUI, I would suggest using TreeSize: http://www.jam-software.com/freeware/index.shtml

If you prefer to use the du command line with the unix utils command: http://unxutils.sourceforge.net/

+5
source

All Articles