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

ASP
asp 网站静态化函数代码html
asp利用Split函数进行多关键字检索
ASP动态include文件
用ASP开发网页需要牢记的注意事项
利用ASP发送和接收XML数据的处理方法
Session对象失效的客户端解决方法
一次性下载远程页面上的所有内容
asp模板引擎终结者(WEB开发之ASP模式)
浅谈 ASP 模板技术之参数传递
本人常用的分页代码
也谈采集入库的技术
简单分页函数一 常用
msxml3.dll 错误 ''800c0005''解决方案
[原创]本人常用的asp代码
生成所有页面的效果+分页生成
[原创]关于Script的Defer属性
[原创]asp截取字符串的两种应用
内容分页函数
[ASP]精华代码
asp提高首页性能的一个技巧

ASP实例教程:Drive对象


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 45 ::
收藏到网摘: 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>