Thursday, June 27, 2013

Batch File to Calculate Disk Space

If you need to calculate disk space used by a directory or by some files, the batch file below can be useful for you. If you call it with the parameter /d it lists each subdirectory. Without any parameters it just prints the total number of files and bytes.
@echo off
if not '%1=='/d goto howmuch1
dir /a-d /s|find "i"|find /v "Volume"|more
goto done
:howmuch1
dir /a-d /s|find "file(s)"|sort /r|find /n "f"|find "[1]"

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