当前位置: 首页 > 网络学院 > 服务端脚本教程 > ASP > ASP Drive

ASP
ASP 介绍
ASP Install
ASP 语法
ASP 变量
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa
ASP Send e-mail
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
ASP FileSystem
ASP TextStream

ASP Drive


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 539 ::
收藏到网摘: n/a

The Drive object is used to return information about a local disk drive or a network share.
Drive(驱动)对象是用来返回本地驱动盘或网络共享盘中的信息的。


Examples
举例

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.
这个例子告诉我们如何建立一个FileSyetemObject对象,以及如何使用AvailableSpace(有效空间)属性获取指定驱动器的已用空间。

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.
这个例子告诉我们如何使用FreeSpace属性获取指定驱动器的空闲空间。

Get the total size of a specified drive
获取指定驱动器的总空间大小
This example demonstrates how to use the TotalSize property to get the total size of a specified drive.
这个例子告诉我们如何使用TotalSize属性获取指定驱动器的总空间大小。

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.
这个例子告诉我们如何使用DriveLetter属性获取指定驱动器的盘符号。

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.
这个例子告诉我们如何使用DriveType属性获取指定驱动器的驱动器类型。

Get the file system of a specified drive
获取指定驱动器的文件系统信息
This example demonstrates how to use the FileSystem property to get the file system of a specified drive.
这个例子告诉我们如何使用FileSystem属性获取指定驱动器的文件系统信息。

Is the drive ready?
驱动器是否出于活动状态?
This example demonstrates how to use the IsReady property to check whether a specified drive is ready.
这个例子告诉我们如何使用IsReady属性检查指定的驱动器是否出于活动状态。

Get the path of a specified drive
获取指定驱动器的路径
This example demonstrates how to use the Path property to get the path of a specified drive.
这个例子告诉我们如何使用Path属性获取指定驱动器的路径信息。

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.
这个例子告诉我们如何使用RootFolder属性获取指定驱动器的根目录。

Get the serialnumber of a specified drive
获取指定驱动器的序列号
This example demonstrates how to use the Serialnumber property to get the serialnumber of a specified drive.
这个例子告诉我们如何使用Serialnumber属性获取指定驱动器的序列号。


The Drive Object
Drive(驱动器)对象

The Drive object is used to return information about a local disk drive or a network share. The Drive object can return information about a drive's type of file system, free space, serial number, volume name, and more.
驱动器对象是用来返回关于本地驱动器以及网络共享文档的信息的。这个驱动器对象可以返回文件系统的驱动器类型、可用空间大小、序列号、驱动器名以及其它相关信息。

Note: You cannot return information about a drive's content with the Drive object. For this purpose you will have to use the Folder object.
注意:你不能通过Drive对象返回驱动器的内容信息,要实现这个目的,你只能通过使用Folder对象来实现。

To work with the properties of the Drive object, you will have 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.
你必须通过FileSystemObject对象建立一个驱动器对象的实体。首先,建立一个FileSystemObject对象,通过GetDrive方法或FileSystemObject对象的属性列出驱动器对象。

The following example uses the GetDrive method of the FileSystemObject object to instantiate the Drive object and the TotalSize property to return the total size in bytes of the specified drive (c:):
下面的例子使用FileSystemObject中的GetDrive方法列出了驱动器的对象;通过使用TotalSize属性返回了指定驱动器(C:)的字节总数:

<%
Dim fs,d
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set d=fs.GetDrive("c:")
Response.Write("Drive " & d & ":")
Response.Write("Total size in bytes: " & d.TotalSize)
set d=nothing
set fs=nothing
%>

Output:

Drive c: Total size in bytes: 4293563392

The Drive object's properties are described below:
Drive(驱动器)对象属性描述如下:

Properties
属性

Property
属性
Description
描述
AvailableSpace Returns the amount of available space to a user on a specified drive or network share
返回指定盘符或网络共享驱动器的已使用空间的总数
DriveLetter Returns one uppercase letter that identifies the local drive or a network share
返回指定驱动器或网络共享驱动器的所在盘符的大写字母
DriveType Returns the type of a specified drive
返回指定驱动器的类型
FileSystem Returns the file system in use for a specified drive
返回指定驱动器所使用的文件系统
FreeSpace Returns the amount of free space to a user on a specified drive or network share
返回指定驱动器或网络共享驱动器的空闲空间大小
IsReady Returns true if the specified drive is ready and false if not
检查指定驱动器是否处于活动状态,是返回“True”,否返回“False”
Path Returns an uppercase letter followed by a colon that indicates the path name for 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 for a specified drive
返回指定盘符的网络共享(文件夹或盘符)名称
TotalSize Returns the total size of a specified drive or network share
返回指定驱动器以及网络共享盘符的总大小
VolumeName Sets or returns the volume name of a specified drive
设置会返回指定驱动器的卷名

评论 (0) All

登陆 | 还没注册?