Did you find this useful?
Socialize it today.

ASP Drive Object

Monday, September 17, 2012

tags ASP

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:


AvailableSpaceReturns the amount of space available to the user on the specified drive.
DriveLetterReturns one uppercase letter that identifies the specified drive.
DriveTypeReturns the type of the specified drive.
FileSystemReturns the type of file system for the specified drive.
FreeSpaceThe FreeSpace property returns the actual total amount of free space available on the specified drive (same as Available space unless there are quotas).
IsReadyReturns True if the specified dive is ready for operation and False if not.
PathReturns the path for the specified drive as an uppercase letter followed by a colon.
RootFolderReturns a Folder object representing the root folder of the specified drive.
SerialNumberReturns the decimal serial number used to uniquely identify a disk volume.
ShareNameReturns the network share name for the specified drive, if it's shared.
TotalSizeReturns the total size of the specified drive or network share.
VolumeNameSets or returns the volume name of the specified drive if it is a local drive.


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)

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.

Recommended Books & Training Resources

Sams Teach Yourself Active Server Pages 3.0 in 21 Days Beginning ASP Databases ASP In A Nutshell