Solved

Retrieving Actual Disk Size with VBScript

Posted on 2003-11-12
1
1,117 Views
Last Modified: 2012-06-27
I currently have a script written that retrieves the amount of space being used on a drive.  It shows the "Size" but not the "Size on Disk".  When you right click on a folder or drive and say properties it shows the "Size on Disk" which is the accuracy that I need for my script.  But I can't find how to retrieve this info using vbscript.  Does anybody know any links to sample code that does this.  Any suggestions appreciated.
0
Comment
Question by:Sacrificial_Lamb
1 Comment
 
LVL 19

Accepted Solution

by:
Dexstar earned 125 total points
ID: 9735722
Sacrificial_Lamb:

> It shows the "Size" but not the "Size on Disk".  When you right click on a
> folder or drive and say properties it shows the "Size on Disk" which is the
> accuracy that I need for my script.

The FileSystemObject doesn't support that property.  You could write your own COM object that uses the Win32 APIs to look it up, and then invoke that from VBScript.

You could also compute the value using the sector size of the disk, like this:
     SizeOnDisk = CInt((objFile.Size / SECTOR_SIZE) + 0.5)*SECTOR_SIZE

But that isn't going to be 100% accurate, and it won't help you if the file is compressed via NTFS compression.

Hope that helps,
Dex*
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rubik's Cube Code for Effective Presentation 3 74
Regular Expression Calculator Tester 2 87
Eclipse Java import and method not resolved 4 73
BATCH to EXE Converter 2 67
This article will show, step by step, how to integrate R code into a R Sweave document
This is an explanation of a simple data model to help parse a JSON feed
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

680 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