Latest web development tutorials

ASP Drive Object

Drive object is used to return information about a local disk drive or network share drives.


Examples

Try - Example

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

Gets the specified number of drive space available
This example demonstrates how to first create a FileSystemObject object and then use AvailableSpace property to get the free space on a specified drive.

Obtain a specified drive space capacity
This example demonstrates how to use the space FreeSpace property to get the remaining space of a specified drive.

Obtain a specified drive drive letter
This example demonstrates how to use the DriveLetter property to obtain a specified drive drive letter.

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

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

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

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

Gets the specified drive's root folder
This example demonstrates how to use the RootFolder property to get the specified drive's root folder.

Gets the specified drive's serial number
This example demonstrates how to use the Serialnumber property to get the specified drive serial number.


Drive Object

Drive object is used to return information about a local disk drive or network share drives. Drive object can return information about the drive's file system type, remaining capacity, serial number, volume name and other information.

Note: You can not return information about the contents of the drive through the Drive object.To achieve this purpose, please use the Folder object.

For operations related attributes Drive objects, you need to create an instance of the Drive object through the FileSystemObject object. First, create a FileSystemObject object and then by GetDrive method or the Drives property of the FileSystemObject object to instantiate the Drive object.

Property Description Drive object as follows:

Attributes

属性 描述
AvailableSpace 向用户返回在指定的驱动器或网络共享驱动器上的可用空间容量。
DriveLetter 返回识别本地驱动器或网络共享驱动器的大写字母。
DriveType 返回指定驱动器的类型。
FileSystem 返回指定驱动器所使用的文件系统。
FreeSpace 向用户返回在指定的驱动器或网络共享驱动器上的剩余空间容量。
IsReady 如果指定驱动器已就绪,则返回 true。否则返回 false。
Path 返回其后有一个冒号的大写字母,用来指示指定驱动器的路径名。
RootFolder 返回一个文件夹对象,该文件夹代表指定驱动器的根文件夹。
SerialNumber 返回指定驱动器的序列号。
ShareName 返回指定驱动器的网络共享名。
TotalSize 返回指定的驱动器或网络共享驱动器的总容量。
VolumeName 设置或者返回指定驱动器的卷标名。