ASP Drive Object

The Drive object represents a physical drive. This drive can exist on your machine, or it can be a drive shared by another machine. To work with the Drive object’s properties, you need to create an instance of the FileSystemObject object first and then instantiate the Drive object through the GetDrive method or the Drives property of the FileSystemObject object.

The Drive object properties are as follows:

Properties

Properties Description
AvailableSpace The AvailableSpace property returns the amount of space available to the user on the specified drive or network share.
DriveLetter The DriveLetter property returns one uppercase letter that identifies the local drive or a network share.
DriveType The DriveType property reruns the type of the specified drive.
FileSystem The FileSystem property returns the type of file system for the specified drive.
FreeSpace The FreeSpace property returns the actual total amount of free space available on the specified drive. This is the same value as that for the AvailableSpace property unless the drive represented by the Drive object supports quotas.
IsReady The IsReady property returns True if the specified dive is ready for operation and False if not.
Path The Path property returns the path for the specified drive as an uppercase letter followed by a colon, i.e. “C:”.
RootFolder The RootFolder property returns a Folder object representing the root folder of the specified drive.
SerialNumber The SerialNumber property returns the decimal serial number used to uniquely identify a disk volume.
ShareName The ShareName property returns the network share name for the specified drive, if it’s shared.
TotalSize The TotalSize property returns the total size (in bytes) of the specified drive or network share.
VolumeName The VolumeName property sets or returns the volume name of the specified drive if it is a local drive.

How to use the ASP Drive Object

In the following example we create an instance of the FileSystemObject object and then use the GetDrive method to instantiate the Drive object. After that we use The Drive object properties to get the information about the specified drive (c:):

<%
Dim objFSO, objDrive
'Create a FileSystemObject instance
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'Using the GetDrive method of FileSystemObject object, initialize a Drive object
Set objDrive = objFSO.GetDrive("C:")
'Retrieve information about the drive
Response.Write "FileSystem: " & objDrive.FileSystem & "<br />"
Response.Write "SerialNumber: " & objDrive.SerialNumber & "<br />"
Response.Write "VolumeName: " & objDrive.VolumeName & "<br />"
Response.Write "AvailableSpace: " & objDrive.AvailableSpace & " bytes<br />"
Response.Write "FreeSpace: " & objDrive.FreeSpace & " bytes <br/>"
Response.Write "TotalSize: " & objDrive.TotalSize & " bytes"
%>
admin

admin

Leave a Reply

Your email address will not be published.