GetSpecialFolder Method 返回特定的Windows文件夹的路径: Windows安装目录;Windows系统目录;Windows临时目录 FSO.GetSpecialFolder([0, 1, or 2])
GetTempName Method 返回一个随机产生的文件或者目录名字,用于需要存储临时数据时
GetAbsolutePathName Method 返回文件夹的绝对路径(类似于Server.MapPath)。
比如,FSO.GetAbsolutePathName("region") 将返回类似于下面的结果:"c:mydocsmyfolder egion"
GetExtensionName Method 返回路径中最后部分的扩展名
(比如:FSO.GetExtensionName("c:docs est.txt") 将返回txt)
GetBaseName and GetParentFolder Methods 返回路径中最后部分的父文件夹
(比如:FSO.GetParentFolder ("c:docsmydocs") 将返回'docs')
Drives Property 返回所有本地可用驱动器的集合,用于建立资源浏览器样的用户接口。
使用上面的功能时,最好建立好出错处理的代码。因为如果需要的参数不存在,将会产生麻烦的信息。
怎样读取一个文本文件的内容?
Ever want to know how to display the contents of a text document using ASP. Here is a easy way to read
from a text file
<!--Start of ASP Code---->
<%
'by James Seymour, http://jamesdot.org
Dim write
Dim fileSysObj, tf, read
' Read the read.txt
' Store the file name where the Information is stored into a variable called read
read = "read.txt"
' Retrieve the fullpath of the read file
read = LEFT(Server.Mappath(Request.ServerVariables("PATH_INFO")), InStrRev(Server.Mappath
(Request.ServerVariables("PATH_INFO")), "\")) & read
' Create an instance of FileSystem Object and store it into a variable called fileSysObj
Set fileSysObj = createObject("Scripting.FileSystemObject")
' Check whether the read file exists
IF (fileSysObj.FileExists(read)) Then
' if the file exists, then open it for reading
Set tf = filesysobj.OpenTextFile(read, 1)
read = tf.ReadLine
tf.Close
ELSE
' if you can't find read.text, display default message
read = "I can't find the file read.txt! So this is my default message."
END IF
%>
' table the displays the read.txt file
<div align="center">
<center>
<table border="0" width="40%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#EEEECC"><B><%=read%></B>
</td>
</tr>
<tr>
<td width="100%">
<!-- End of the ASP -->
use the code above, click and drag your mouse over the code to highlight it. Then right click on the
highlighted code and click "Copy." Now you may paste it into your code editor.
posted on 2005-10-28 11:42
ilvs 阅读(200)
评论(0) 编辑 收藏 引用 所属分类:
学学别人的