Drive
Drive is an object, which provides access to the properties of a particular disk drive or network share. The Following properties are supported by Driveobject:
• AvailableSpace
• DriveLetter
• DriveType
• FileSystem
• FreeSpace
• IsReady
• Path
• RootFolder
• SerialNumber
• ShareName
• TotalSize
• VolumeName
Example
<!DOCTYPE html>
<html>
<body>
<script language="vbscript" type="text/vbscript">
Dim oFS, drive, space
Set oFS = CreateObject("Scripting.FileSystemObject")
Set drive = oFS.GetDrive(oFS.GetDriveName("C:\"))
space = "Drive " & UCase(drvPath) & " - "
space = space & drive.VolumeName & " "
space = space & "Free Space: " & FormatNumber(drive.FreeSpace/1024, 0)
space = space & " Kbytes"
Document.write space
</script>
</body>
</html>
If the above script is saved as HTML and executed in IE,
we would get the following output in the console.
Drive - Win 7 Free Space:20,154,059 Kbytes