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

ASP
Asp+Sql 对数据库的各种操作
ASP:6行代码实现无组件上传
ASP中几种分页显示的比较
ASP中数据库调用中常见错误的现象和解决
ASP实用技巧:强制刷新和判断文件地址
asp全站防止注入的代码
ASP如何获取客户端真实IP地址
ASP实现可显示和隐藏的树型菜单
如何用ASP获取真实IP地址
ASP与SQL数据库连接代码
拒绝攻击 万能Asp防注入代码
草根站长成长计划:跟我学新云采集入门(2)
ASP技巧:提高使用Request集合的效率
Asp用存储过程实现数据分页
做网页时常用的ASP函数
Asp编码优化技巧八则
ASP中Cache技术的应用
用ASP封IP的方法,防止固定IP垃圾留言
ASP实现一行多列显示方法实例程序
ASP实现动态添加表单内容的实例程序

ASP实例教程:Drive对象


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