Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
March 15, 2006
NOTE: See How can a script determine the size of a folder, using standard commands?
Using Diruse.exe, in the public domain, because it runs much faster, I have scripted FolderSize.bat to determine the size of a folder, including all sub-folders and files.
The syntax for using FolderSize.bat is:
Call FolderSize FolderPath Size
Where:
FolderPath is the path to the folder you wish to enumerate.Size is a call directed environment variable that will contain the number of bytes.
FolderSize.bat contains:
@echo offif {%2}=={} @echo Syntax: FolderSize FolderPath Size&goto :EOFif not exist %1 @echo Syntax: FolderSize FolderPath Size - %1 not found.&goto :EOFfor /f "Tokens=2" %%a in ('diruse /s /b /d /q:999999999999999999999 %1^|find " TOTAL:"') do ( set %2=%%a)
Read more about:
MicrosoftYou May Also Like