Link to home
Start Free TrialLog in
Avatar of lescluster
lescluster

asked on

Batch - size of directory question.

Is it possible to detect size of directory and if so what would be the syntax to do that with batch file and echo out the result ot text file?
Avatar of maphew
maphew


dir [dir name] | find "File(s)" > results.txt

ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lescluster

ASKER

Steve
It appears that all I am getting is the size of the file in that directory but not in the subfolders. I have subfolders in the misc directory that I would like to include in the count.  I am using your script like that:
@echo off
cd \documents and settings\misc
for /f "tokens=3" %%a in ('dir /-c ^| find "File(s)"') do set sizeofdir=%%a
echo Size of dir %cd% is %sizeofdir%

Thanks
Steve
I figure that out -  had to use \s switch -  thanks much for your help
duh - just notice you were already talking about /s -  need some sleep.
Thanks again
Haha, no problem.  glad to help, was just a quick answer while shutting down PC for the night anyway...
Steve