asp目錄讀寫權(quán)限檢測(cè)腳本 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.dhdzp.com/codes/39929.html
相關(guān)文章
在Vista IIS 7 中用 vs2005 調(diào)試 Web 項(xiàng)目的注意事項(xiàng)
在Vista IIS 7 中用 vs2005 調(diào)試 Web 項(xiàng)目核心是要解決以下幾個(gè)問(wèn)題2008-09-09
服務(wù)端 VBScript 與 JScript 幾個(gè)相同特性的寫法與示例
服務(wù)端 VBScript 與 JScript 幾個(gè)相同特性的寫法與示例...2007-03-03
asp正則替換鏈接實(shí)現(xiàn)偽靜態(tài)效果
有時(shí)候我們需要將頁(yè)面中的動(dòng)態(tài)頁(yè)面替換為我們偽靜態(tài)的格式,一般是頁(yè)面內(nèi)容中批量替換2013-08-08
ASP之處理用Javascript動(dòng)態(tài)添加的表單元素?cái)?shù)據(jù)的代碼
ASP之處理用Javascript動(dòng)態(tài)添加的表單元素?cái)?shù)據(jù)的代碼...2007-11-11
解決 JScript 中使用日期類型數(shù)據(jù)時(shí)出現(xiàn)類型錯(cuò)誤的問(wèn)題
在服務(wù)端JScript中,有些時(shí)候需要使用日期類型的數(shù)據(jù),比如說(shuō)設(shè)置一個(gè)cookie的到期時(shí)間,更新數(shù)據(jù)庫(kù)中的日期字段等。但是按照平常的方法來(lái)用js里的date類型數(shù)據(jù)時(shí),運(yùn)行時(shí)就會(huì)發(fā)生錯(cuò)誤。2008-05-05
利用ASP從遠(yuǎn)程服務(wù)器上接收XML數(shù)據(jù)的方法
利用ASP從遠(yuǎn)程服務(wù)器上接收XML數(shù)據(jù)的方法...2007-01-01

