Wednesday, May 29, 2013

Calculate Folder Size in Batch File

It is neccessary sometimes to calculate the size of a certain folder in batch file. Though it is easy to see the size of a folder in Windows, calculating it in a batch script can be considered quite a complicated task. This small script will help you with this task:
@Echo Off
For /F "Tokens=3*" %%a In (
'Dir /-C C:\Temp ^| Find "files"') Do Echo The C:\Temp folder size = %%a
pause
Of course you should first change 'c:\Temp' to path to the folder which size you want to calculate.
We kindly remind that Dr.Batcher is the best program to create batch file, both .BAT and .CMD, try it if haven't tried it yet. 

No comments:

Post a Comment

Translate