当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP实例教程:Drive对象

ASP
ASP实例代码:搞个长文章分页代码
说说对象的复制
多个函数验证同一表单
查询某个字段没有值的所有记录的SQL语句怎么写?
ASP实例:一个简单的ASP无组件上传类
ASP实例讲解:用分页符实现长文章分页显示
ASP实例:动态网页中常用的6个ASP程序
ASP实例:词语搭配游戏的制作
ASP实例学习:随机生成文件名的函数
asp实例:测试WEB服务器
ASP实例:计数器程序详解
预防ASP网站被黑 彻底了解ASP木马
分享:XML HTTP Request的属性和方法简介
ASP架设:给每个IIS站点建立一个用户
ASP技巧:判断远程图片是否存在
故障解决:解决ASP脚本运行超时的方法
再说ASP输出N行N列表格
怎么判断一个对象是否已被释放
ASP实现网页打开任何类型文件都保存的方法
ASP技巧:利用函数InstrRev()获取当前文件名

ASP实例教程:Drive对象


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

Drive 对象

注意:本实例教程因为和具体空间的驱动器有关,所以运行结果请自行测试,不再提供运行结果。

取得指定驱动器的可用空间数

本例演示如何首先创建一个FileSystemObject对象,然后使用AvailableSpace属性来获得指定驱动器的可用空间。

本实例代码如下:

<html>
<body>
<%
Dim fs, d, n
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set d=fs.GetDrive("c:")
n = "驱动器:" & d
n = n & "<br>以字节计的可用空间:" & d.AvailableSpace
Response.Write(n)
set d=nothing
set fs=nothing
%>
</body>
</html>

取得指定驱动器的剩余空间容量

本例演示如何使用FreeSpace空间属性来取得指定驱动器的剩余空间。

本实例代码如下:

<html>
<body>
<%
Dim fs, d, n
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set d=fs.GetDrive("c:")
n = "驱动器:" & d
n = n & "<br />以字节计的剩余空间:" & d.FreeSpace
Response.Write(n)
set d=nothing
set fs=nothing
%>
</body>
</html>

取得指定驱动器的总容量

本例演示如何使用TotalSize属性来获得指定驱动器的总容量。

本实例代码如下:

<html>
<body>
<%
Dim fs,d,n
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set d=fs.GetDrive("c:")
n = "驱动器:" & d
n = n & "<br>以字节计的总容量:" & d.TotalSize
Response.Write(n)
set d=nothing
set fs=nothing
%>
</body>
</html>

取得指定驱动器的驱动器字母

本例演示如何使用DriveLetter属性来获得指定驱动器的驱动器字母。

本实例代码如下:

<html>
<body>
<%
dim fs, d, n
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("驱动器字母是:" & d.driveletter)
set d=nothing
set fs=nothing
%>
</body>
</html>

取得指定驱动器的驱动器类型

本例演示如何使用DriveType属性来获得指定驱动器的驱动器类型。

本实例代码如下:

<html>
<body>
<%
dim fs, d, n
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("驱动器类型是:" & d.DriveType)
set d=nothing
set fs=nothing
%>
</body>
</html>

取得指定驱动器的文件系统信息

本例演示如何使用FileSystem来取得指定驱动器的文件系统类型。

本文由软晨学习网(http://www.ruanchen.com)整理发布!转载请注明出处,谢谢!

本实例代码如下:

<html>
<body>
<%
dim fs, d, n
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("文件系统是:" & d.FileSystem)
set d=nothing
set fs=nothing
%>
</body>
</html>

驱动器是否已就绪?

本例演示如何使用IsReady属性来检查指定的驱动器是否已就绪。

本实例代码如下:

<html>
<body>
<%
dim fs,d,n
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
n = "此 " & d.DriveLetter
if d.IsReady=true then
    n = n & " 驱动器已就绪。"
else
    n = n & " 驱动器未就绪。"
end if
Response.Write(n)
set d=nothing
set fs=nothing
%>
</body>
</html>

取得指定驱动器的路径

本例演示如何使用Path属性来取得指定驱动器的路径。

本实例代码如下:

<html>
<body>
<%
dim fs,d
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("路径是:" & d.Path)
set d=nothing
set fs=nothing
%>
</body>
</html>

取得指定驱动器的根文件夹

本例演示如何使用RootFolder属性来取得指定驱动器的根文件夹。

本实例代码如下:

<html>
<body>
<%
dim fs,d
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("根文件是:" & d.RootFolder)
set d=nothing
set fs=nothing
%>
</body>
</html>

取得指定驱动器的序列号

本例演示如何使用Serialnumber属性来取得指定驱动器的序列号。

本文由软晨学习网(www.ruanchen.com)发布!转载和采集的话请不要去掉!谢谢。

本实例代码如下:

<html>
<body>
<%
dim fs,d
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("序列号:" & d.SerialNumber)
set d=nothing
set fs=nothing
%>
</body>
</html>