日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

使用FSO自動創(chuàng)建多級文件夾的函數(shù)_ASP教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:ASP實例:計數(shù)器程序詳解
Active Server Pager(動態(tài)服務(wù)器主頁,簡稱ASP),通過讀寫服務(wù)器的文件,結(jié)合script語言(VBscript或Jscript)和html碼可以方便地實現(xiàn)頁面計數(shù)器功能�,F(xiàn)流行的ASP教材和網(wǎng)絡(luò)上的ASP教程都談到

開啟FSO權(quán)限 在 開始-“運行”中執(zhí)行regsvr32.exe scrrun.dll即可。如想關(guān)閉FSO權(quán)限,在上述命令中加/u參數(shù)。注冊表中的鍵值位置:HKEY_CLASS_BOOT\F.S.O .FSO中有個方法是CreateFolder,但是這個方法只能在其上一級文件夾存在的情況下創(chuàng)建新的文件夾,所以我就寫了一個自動創(chuàng)建多級文件夾的函數(shù),在生成靜態(tài)頁面等方面使用非常方便。函數(shù):

以下為引用的內(nèi)容:
’ --------------------------------
’ 自動創(chuàng)建指定的多級文件夾
’ strPath為絕對路徑
Function AutoCreateFolder(strPath) ’ As Boolean
On Error Resume Next
Dim astrPath, ulngPath, i, strTmpPath
Dim objFSO
If InStr(strPath, "\") <=0 Or InStr(strPath, ":") <= 0 Then
AutoCreateFolder = False
Exit Function
End If
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strPath) Then
AutoCreateFolder = True
Exit Function
End If
astrPath = Split(strPath, "\")
ulngPath = UBound(astrPath)
strTmpPath = ""
For i = 0 To ulngPath
strTmpPath = strTmpPath & astrPath(i) & "\"
If Not objFSO.FolderExists(strTmpPath) Then
’ 創(chuàng)建
objFSO.CreateFolder(strTmpPath)
End If
Next
Set objFSO = Nothing
If Err = 0 Then
AutoCreateFolder = True
Else
AutoCreateFolder = False
End If
End Function

調(diào)用方法:

以下為引用的內(nèi)容:

MyPath = "C:\a\b\c\"
If AutoCreateFolder(MyPath) Then
Response.Write "創(chuàng)建文件夾成功"
Else
Response.Write "創(chuàng)建文件夾失敗"
End If

分享:ASP實例學(xué)習(xí):隨機生成文件名的函數(shù)
以下為引用的內(nèi)容: <html> <meta http-equiv="Refresh" content="2"> <!--  Place this

來源:模板無憂//所屬分類:ASP教程/更新時間:2008-08-22
相關(guān)ASP教程