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.dbjr.com.cn/codes/39929.html
相關(guān)文章
檢查access數(shù)據(jù)庫(kù)中是否存在某個(gè)名字的表的asp代碼
首先調(diào)用adodb.connection對(duì)象中的openSchema函數(shù),這樣會(huì)得到一個(gè)Recordset,其中每一條“紀(jì)錄”對(duì)應(yīng)著數(shù)據(jù)庫(kù)中的一張表,“紀(jì)錄”的每個(gè)“字段”包含了對(duì)應(yīng)表的某方面信息。其中TABLE_NAME字段包含了對(duì)應(yīng)表的名稱2009-06-06ASP UTF-8編碼下字符串截取和獲取長(zhǎng)度函數(shù)
截取文字長(zhǎng)度函數(shù),支持UTF-8 ,這樣就可以滿意大部分截取字符串的朋友了。2009-05-05ASP網(wǎng)站出現(xiàn) msxml3.dll 錯(cuò)誤 80072ee7 錯(cuò)誤的解決方法
這兩天接到通知,說(shuō)公司的一個(gè)網(wǎng)站訪問(wèn)不了,經(jīng)訪問(wèn)發(fā)現(xiàn)頁(yè)面提示如下錯(cuò)誤2011-08-08asp下利用fso實(shí)現(xiàn)文件夾或文件移動(dòng)改名等操作函數(shù)
以后利用fso來(lái)操作文件和文件夾就方便了2008-01-01插件下載┊垃圾引用防御補(bǔ)丁(每小時(shí)自動(dòng)換KEY,支持靜態(tài)頁(yè)面)
插件下載┊垃圾引用防御補(bǔ)丁(每小時(shí)自動(dòng)換KEY,支持靜態(tài)頁(yè)面)...2007-02-02ASP訪問(wèn)數(shù)量統(tǒng)計(jì)代碼
asp創(chuàng)建訪問(wèn)統(tǒng)計(jì)代碼,實(shí)例2008-10-10ASP中不用模板生成HTML靜態(tài)頁(yè)面的方法
我們一般生成HTML靜態(tài)頁(yè)時(shí),常常會(huì)事先做好一個(gè)模板,然后生成時(shí)調(diào)用模板文件。那么有沒(méi)有辦法不用模板,如一個(gè)正常的htmer.asp頁(yè)面,直接生成為htmer.html頁(yè)面呢?2010-06-06