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

ASP
ASP中数据库调用中常见错误的现象和解决方法
ASP取出HTML里面的图片地址的函数
关于分页查询和性能问题
利用Asp生成整站静态
用ASP+XMLHTTP编写一个天气预报程序
轻松检测浏览器是否接受Cookies信息
净化网络环境:ASP程序实现过滤脏话
入门:防范SQL注入攻击的新办法
如何对ASP.NET进行性能优化
ASP无法更新ACCESS数据库解决方法
ASP:利用ASP把图片上传到数据库
ASP:用ASP编程实现网络内容快速查找
ASP:用ASP打造一个小型的网页BBS系统
ASP:用Asp编程实现QQ的在线情况查询
通过表单创建word的一个例子
在ASP中轻松实现记录集分页显示
ASP中实现小偷程序的原理和简单示例
ASP:6行代码实现无组件上传
实用篇:用asp实现QQ在线查询
如何轻松打造ASP计数器

ASP实例教程:Drive对象


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