ASP 101 - Active Server Pages 101 - Web03
The Place ASP Developers Go!

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

 Top ASP 101 Stories Top ASP 101 Stories
Connections, Commands, And Procedures
What is ASP?
VBScript Classes: Part 1 of N

Autofix IIS Failures
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates

Quick Tips

Keeping an Eye on Free Disk Space

With the size and cost of hard drives these days this probably isn't as big a deal as it used to be, but there are still times when your server might fill up it's hard drive. This happened to me the other day and it caught me totally off guard. So I whipped up this little script to help me keep an eye on things.

Dim objFSO
Dim objDrive
Set objFSO   = Server.CreateObject("Scripting.FileSystemObject")
Set objDrive = objFSO.GetDrive("C:")
Response.Write "<pre>" & vbCrLf
Response.Write "Drive Letter: "
Response.Write objDrive.DriveLetter
Response.Write vbCrLf
Response.Write "Volume Name:  "
Response.Write objDrive.VolumeName
Response.Write vbCrLf
Response.Write "Free Space:   "
Response.Write FormatNumber(objDrive.FreeSpace, 0) & " bytes"
Response.Write vbCrLf
Response.Write "Total Size:   "
Response.Write FormatNumber(objDrive.TotalSize, 0) & " bytes"
Response.Write vbCrLf
Response.Write "Percent Free Space: "
Response.Write FormatPercent(objDrive.FreeSpace / objDrive.TotalSize)
Response.Write vbCrLf
Response.Write "</pre>" & vbCrLf
Set objDrive = Nothing
Set objFSO = Nothing

For most sites storage isn't a big deal. Web files tend to be relatively small and storage isn't usually a problem, but if you're hosting somewhere with a storage limit or your site allows users to upload files you could be out of space before you know it... at least now you can easily check.

Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to:

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers