How to Display Folder size ?

Posted on 2003-03-11
Medium Priority
Last Modified: 2007-12-19
IS there any way to see the size of folder in either CMD> and Windows Explorer without the contents/files ?

Please Advise
Question by:joehuang
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8114728
In windows explorer, Right click "folder", select "properties".

Is this what you require?

Expert Comment

ID: 8114765
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.
LVL 22

Expert Comment

ID: 8115561
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%

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Expert Comment

ID: 8116526

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.


Expert Comment

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

LVL 22

Accepted Solution

cookre earned 60 total points
ID: 8117100
Well, in that case, one could always test for the same directory with a bit of effort and some extra CMD files given that the NT DOS extensions include:

/a on SET for evaluating expressions:
set /a filcnt=%%a - 1

and the ability to extract a parameter's drive letter with %~dx and path with %~fx, where x is the parameter number.
(left as an exercise for the over-eager lurker)


Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question