ASP DriveObject


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


Examples

Try it Yourself - Examples

Get the total capacity of a specified drive
This example demonstrates how to use the TotalSize property to get the total capacity of a specified drive.

Get the available space of a specified drive
This example demonstrates how to first create a FileSystemObject object, and then use the AvailableSpace property to get the available space of a specified drive.

Get the free space of a specified drive
This example demonstrates how to use the FreeSpace property to get the free space of a specified drive.

Get the drive letter of a specified drive
This example demonstrates how to use the DriveLetter property to get the drive letter of a specified drive.

Get the drive type of a specified drive
This example demonstrates how to use the DriveType property to get the drive type of a specified drive.

Get the file system information of a specified drive
This example demonstrates how to use the FileSystem property to get the file system information of a specified drive.

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

Get the path of a specified drive
This example demonstrates how to use the Path property to get the path of a specified drive.

Get the root folder of a specified drive
This example demonstrates how to use the RootFolder property to get the root folder of a specified drive.

Get the serial number of a specified drive
This example demonstrates how to use the Serialnumber property to get the serial number of a specified drive.


Drive Object

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

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

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

The properties of the Drive object are described below:

Properties

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

Other Extensions