Computer Hope

Microsoft => Microsoft DOS => Topic started by: nubia on February 17, 2009, 09:12:09 PM

Title: How to determine directory size?
Post by: nubia on February 17, 2009, 09:12:09 PM
I've looked at all the Dos Commands at http://www.computerhope.com/overview.htm (http://www.computerhope.com/overview.htm)
and don't seem to be able to find out how to get the size of a Windows directory.
Does anyone know if this is possible?
-nubia
Title: Re: How to determine directory size?
Post by: BC_Programmer on February 17, 2009, 09:20:11 PM
dir

the size is listed at the bottom of the listing.
Title: Re: How to determine directory size?
Post by: nubia on February 17, 2009, 09:43:10 PM
I see at the bottom what it says but this in no way matches what I get when I use Windows explorer and click properties for the selected folder. In the case of C:/Program Files typing 'Dir' at the command prompt I get
53 files 5,571,605 bytes
108 dirs 17,156,722,688 bytes free
And in Windows Explorer I get:
5.65 GB (
Contains 61,614 files 6,636 folders.
-What Gives??
Title: Re: How to determine directory size?
Post by: Geek-9pm on February 17, 2009, 09:53:43 PM
I don't understand oll this DOS stuff,
So I go for the hardware solution.

You get a new blank Hard drive.
Notice how mush space is taken and how much is available.

Now copy the whole directory to the new drive.
Now notice again how much space is use.  :o
From that you can deduce how big the directory is.

Now this, Isn't that a lot easier than
trying to get an answer from these guys?


Title: Re: How to determine directory size?
Post by: nubia on February 17, 2009, 10:03:09 PM
Ha Ha very funny-not really..but seriously though..
Title: Re: How to determine directory size?
Post by: Geek-9pm on February 17, 2009, 10:15:30 PM
Folder Size. Folder properties.
(http://geek9pm.com/folder_size.png)
Does that help?
Title: Re: How to determine directory size?
Post by: Broni on February 17, 2009, 10:27:34 PM
5,571,605 bytes~=5.65 GB
Where is the problem?
Title: Re: How to determine directory size?
Post by: BC_Programmer on February 17, 2009, 10:50:07 PM
5,571,605 bytes~=5.65 GB
Where is the problem?

thats 5 MB silly.


try Dir /S instead.
Title: Re: How to determine directory size?
Post by: Broni on February 17, 2009, 10:54:29 PM
Quote
thats 5 MB silly.
Bed time, I guess ;D
Title: Re: How to determine directory size?
Post by: BatchRocks on February 18, 2009, 05:10:33 PM
Quote
thats 5 MB silly.
Bed time, I guess ;D

Yep.
Title: Re: How to determine directory size?
Post by: GuruGary on February 18, 2009, 05:24:58 PM
Try
Code: [Select]
dir C:\Windows /a /swhich should match either very close, or exactly ... depending on what Windows is doing and how close together you run the DIR and the Explorer Properties.
Title: Re: How to determine directory size?
Post by: nubia on February 18, 2009, 08:02:12 PM
Whew! I did the Dir /s on C:/Program Files and it went on forever! (Well several minutes anyway!)
But yes the results were right on.
Thank you all.
N.
Title: Re: How to determine directory size?
Post by: BatchRocks on February 19, 2009, 08:26:04 AM
Whew! I did the Dir /s on C:/Program Files and it went on forever! (Well several minutes anyway!)
But yes the results were right on.
Thank you all.
N.

Happened to me too ^_^.
Title: Re: How to determine directory size?
Post by: BC_Programmer on February 19, 2009, 01:12:36 PM
If it's a NTFS drive you can use

Code: [Select]
FSUTIL VOLUME DISKFREE C:
Title: Re: How to determine directory size?
Post by: GuruGary on February 19, 2009, 02:18:46 PM
But FSUTIL won't tell you a directory size.
Title: Re: How to determine directory size?
Post by: BC_Programmer on February 19, 2009, 02:24:36 PM
Oops.  ;D
Title: Re: How to determine directory size?
Post by: Dias de verano on February 19, 2009, 03:44:21 PM
The du utility from the Windows 2000 Resource kit is handy.

Code: [Select]
S:\>du /q pdf-dir
Files:        10
Directories:  8
Size:         5,670,819 bytes
Size on disk: 5,670,819 bytes


Code: [Select]
S:\>for /f "tokens=1-3" %A in ('du /q pdf-dir ^| find "Size:"') do @echo %B %C
5,670,819 bytes
Title: Re: How to determine directory size?
Post by: nubia on February 20, 2009, 06:51:32 PM

I guess I don't have du.

Code: [Select]
C:\>du /q program files dir
'du' is not recognized as an internal or external command,
operable program or batch file.

Title: Re: How to determine directory size?
Post by: patio on February 20, 2009, 07:36:21 PM
Keep in mind here that directory/drive/ and folder sizes will all be reported differently depending on the reporting agent itself...
This is commonly known as computer chaos and is built into every machine ever assembled...
Title: Re: How to determine directory size?
Post by: Geek-9pm on February 20, 2009, 08:13:26 PM
Quote
This is commonly known as computer chaos and is built into every machine ever assembled...
Right!
Now I would like to know what is it about us humans that this bothers us so much. This question comes up again and again. Why do people become agitated because the machine can not  provide a precise status report?
Title: Re: How to determine directory size?
Post by: patio on February 20, 2009, 08:26:36 PM
Because we're Human...
Title: Re: How to determine directory size?
Post by: BC_Programmer on February 20, 2009, 08:32:18 PM

I guess I don't have du.

Code: [Select]
C:\>du /q program files dir
'du' is not recognized as an internal or external command,
operable program or batch file.



The du utility from the Windows 2000 Resource kit is handy.

Code: [Select]
S:\>du /q pdf-dir
Files:        10
Directories:  8
Size:         5,670,819 bytes
Size on disk: 5,670,819 bytes


Code: [Select]
S:\>for /f "tokens=1-3" %A in ('du /q pdf-dir ^| find "Size:"') do @echo %B %C
5,670,819 bytes