Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ASP Drive Object

ASP Drive Object


The Drive object is used to return information about local disk drives or network shared drives.


Try it - Example

Getting the Total Capacity of a Specified Drive
This example demonstrates how to use the TotalSize property to obtain the total capacity of a specified drive.

Getting the Available Space on a Specified Drive
This example demonstrates how to first create a FileSystemObject object and then use the AvailableSpace property to obtain the available space on a specified drive.

Getting the Free Space on a Specified Drive
This example demonstrates how to use the FreeSpace property to obtain the free space on a specified drive.

Getting the Drive Letter of a Specified Drive
This example demonstrates how to use the DriveLetter property to obtain the drive letter of a specified drive.

Getting the Drive Type of a Specified Drive
This example demonstrates how to use the DriveType property to obtain the type of a specified drive.

Getting the File System Information of a Specified Drive
This example demonstrates how to use FileSystem to obtain the file system information of a specified drive.

Is the Drive Ready?
This example demonstrates how to use the IsReady property to check whether a specified drive is ready.

Getting the Path of a Specified Drive
This example demonstrates how to use the Path property to obtain the path of a specified drive.

Getting the Root Folder of a Specified Drive
This example demonstrates how to use the RootFolder property to obtain the root folder of a specified drive.

Getting the Serial Number of a Specified Drive
This example demonstrates how to use the Serialnumber property to obtain the serial number of a specified drive.


Drive Object

The Drive object is used to return information about local disk drives or network shared drives. It can return information such as the file system type, free space, serial number, and volume name of a drive.

**Note:** You cannot use the Drive object to return information about the contents of a drive. To do that, use the Folder object.

To work with the properties of a Drive object, you need to create an instance of the Drive object through the FileSystemObject object. First, create a FileSystemObject object, and then instantiate the Drive object through the GetDrive method or the Drives property of the FileSystemObject object.

The properties of the Drive object are described below:

property

property Description
AvailableSpace Returns the amount of available space on a specified drive or network shared drive.
DriveLetter Returns the uppercase letter that identifies a local drive or network shared drive.
DriveType Returns the type of a specified drive.
FileSystem Returns the file system used by a specified drive.
FreeSpace Returns the amount of free space on a specified drive or network shared drive.
IsReady Returns true if the specified drive is ready. Otherwise, returns false.
Path Returns an uppercase letter followed by a colon, indicating the path name of a specified drive.
RootFolder Returns a folder object that represents the root folder of a specified drive.
SerialNumber Returns the serial number of a specified drive.
ShareName Returns the network share name of a specified drive.
TotalSize Returns the total capacity of a specified drive or network shared drive.
VolumeName Sets or returns the volume name of a specified drive.