The ASP Drive object is used to access a physical drive on the web server. To work with the properties of the Drive object, you first create an instance of the FileSystemObject object and then instantiate the Drive object through the GetDrive
method. The Drive object properties are as follows:
Properties
Property | Description |
AvailableSpace | Returns the amount of space available to the user on the specified drive. |
DriveLetter | Returns one uppercase letter that identifies the specified drive. |
DriveType | Returns the type of the specified drive. |
FileSystem | 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 (same as Available space unless there are quotas). |
IsReady | Returns True if the specified dive is ready for operation and False if not. |
Path | Returns the path for the specified drive as an uppercase letter followed by a colon. |
RootFolder | Returns a Folder object representing the root folder of the specified drive. |
SerialNumber | Returns the decimal serial number used to uniquely identify a disk volume. |
ShareName | Returns the network share name for the specified drive, if it's shared. |
TotalSize | Returns the total size of the specified drive or network share. |
VolumeName | Sets or returns the volume name of the specified drive if it is a local drive. |
Example
In the following example we create an instance of the FileSystemObject object and then use the GetDrive method to instantiate the Drive object. Then, we use The Drive object properties to get the information about the specified drive.
<%
Dim objFSO, objDrive
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objDrive = objFSO.GetDrive("C:")
Response.Write("AvailableSpace: " & objDrive.AvailableSpace & " bytes<br />")
Response.Write("DriveLetter: " & objDrive.DriveLetter & "<br />")
Response.Write("DriveType: " & objDrive.DriveType & "<br />")
Response.Write("FileSystem: " & objDrive.FileSystem & "<br />")
Response.Write("FreeSpace: " & objDrive.FreeSpace & " bytes <br />")
Response.Write("IsReady: " & objDrive.IsReady & " bytes<br />")
Response.Write("Path: " & objDrive.Path & "<br />")
Response.Write("RootFolder: " & objDrive.RootFolder & "<br />")
Response.Write("SerialNumber: " & objDrive.SerialNumber & "<br />")
Response.Write("ShareName: " & objDrive.ShareName & "<br />")
Response.Write("TotalSize: " & objDrive.TotalSize & " bytes<br />")
Response.Write("VolumeName: " & objDrive.VolumeName)
%>
Did you find the page informational and useful? Share it using one of your favorite social sites.
Recommended Books & Training Resources