asp目錄讀寫權(quán)限檢測腳本 TestFolder

<%
'Response.Buffer = FALSE
Server.ScriptTimeOut=999999999
Set Fso=server.createobject("scr"&"ipt"&"ing"&"."&"fil"&"esy"&"ste"&"mob"&"jec"&"t")
%>
<%
sPath=replace(request("sPath"),"/","\")
ShowPath=""
if sPath="" then
ShowPath="C:\Program Files\"
else
ShowPath=sPath
end if
%>
<form name="form1" method="post" action="">
<label><br>
</label>
<label> </label>
<table width="80%" border="0">
<tr>
<td><strong>路徑:</strong>
<input name="sPath" type="text" id="sPath" value="<%=ShowPath%>" style="width:500px;height:25px">
<input style="width:160px;height:28px" type="submit" name="button" id="button" value="提交" /> 可以讀 不可讀 可以寫 不可寫</td>
</tr>
</table>
</form>
<%
Dim i1:i1=0
if sPath<>"" then
Call Bianli(sPath)
end if
Set Fso=nothing
%>
<%
Function CheckDirIsOKWrite(DirStr)
On Error Resume Next
Fso.CreateTextFile(DirStr&"\temp.tmp")
if Err.number<>0 then
Err.Clear()
response.write " <font color=red>不可寫</font>"
CheckDirIsOKWrite=0
else
response.write " <font color=green><b>可以寫</b></font>"
CheckDirIsOKWrite=1
end if
End Function
Function CheckDirIsOKDel(DirStr)
On Error Resume Next
Fso.DeleteFile(DirStr&"\temp.tmp")
if Err.number<>0 then
Err.Clear()
response.write " <font color=red>不可刪除</font>"
else
response.write " <font color=green><b>可以刪除</b></font>"
end if
End Function
Function WriteSpace(NunStr)
for iu=0 to NunStr
response.write " "
next
End Function
Function Bianli(path)
On Error Resume Next
i1=i1+1
Set Objfolder=fso.getfolder(path)
Set Objsubfolders=objfolder.subfolders
dim t1:t1=1
WriteSpace(i1)
response.write path
SubFCount=Objsubfolders.count
if Err.number<>0 then
SubFCount=-1
Err.Clear()
end if
if SubFCount>-1 then
response.write " <font color=green>可以讀</font>"
else
response.write " <font color=red>不可讀</font>"
end if
if SubFCount>-1 then
IsWrite=CheckDirIsOKWrite(path)
if IsWrite=1 then CheckDirIsOKDel(path)
For Each Objsubfolder In Objsubfolders
'response.write "<br>("&t1&"/"&Objsubfolders.count&")/<b>"&i1&"</b> "&vbcrlf
response.write "<br> "&vbcrlf
Nowpath=path + "\" + Objsubfolder.name
Set Objfolder=nothing
Set Objsubfolders=nothing
Call Bianli(nowpath)'遞歸
i1=i1-1
t1=t1+1
Next
end if
End Function
%>
另外腳本之家提供一份源碼下載http://www.fzitv.net/codes/39929.html
相關(guān)文章
在Vista IIS 7 中用 vs2005 調(diào)試 Web 項目的注意事項
在Vista IIS 7 中用 vs2005 調(diào)試 Web 項目核心是要解決以下幾個問題2008-09-09
服務端 VBScript 與 JScript 幾個相同特性的寫法與示例
服務端 VBScript 與 JScript 幾個相同特性的寫法與示例...2007-03-03
ASP之處理用Javascript動態(tài)添加的表單元素數(shù)據(jù)的代碼
ASP之處理用Javascript動態(tài)添加的表單元素數(shù)據(jù)的代碼...2007-11-11
解決 JScript 中使用日期類型數(shù)據(jù)時出現(xiàn)類型錯誤的問題
在服務端JScript中,有些時候需要使用日期類型的數(shù)據(jù),比如說設置一個cookie的到期時間,更新數(shù)據(jù)庫中的日期字段等。但是按照平常的方法來用js里的date類型數(shù)據(jù)時,運行時就會發(fā)生錯誤。2008-05-05
利用ASP從遠程服務器上接收XML數(shù)據(jù)的方法
利用ASP從遠程服務器上接收XML數(shù)據(jù)的方法...2007-01-01

