Link to home
Start Free TrialLog in
Avatar of joehuang
joehuang

asked on

How to Display Folder size ?

IS there any way to see the size of folder in either CMD> and Windows Explorer without the contents/files ?

Please Advise
Avatar of netmage
netmage

In windows explorer, Right click "folder", select "properties".

Is this what you require?
Not from the command prompt - no

As far as I'm aware, u can only list folder size from windows explorer by checking the folder properties.
Put this in a cmd file.
Pass it the name of the directory you're interested in.


@echo off
dir /s %1 | find "File(s)" >a.a
for /F "tokens=1-4 delims= " %%a in (a.a) do (
set XXX=Files:%%a Total Size:%%c
)
del a.a
echo %1 : %XXX%

Cookre,

that even works!

well, nearly works.

if you were to use a dir /s/a-d then the filecount would be better. Unfortunately, it'll still be off by 1 because the file 'a.a' will be included in the count, but it's not there before or after.



...Bill
...though, of course the filecount SHOULD be accurate if your logged directory is not included in the tree on which you are reporting.

...Bill
ASKER CERTIFIED SOLUTION
Avatar of cookre
cookre
Flag of United States of America 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