3/01/2012

星期四, 3月 01, 2012
ASP Fso 函式分享:刪除文件DeleteFile與文件夾DeleteFolder
資料來源:http://www.111cn.net/asp/16/05ddb527b7a89bd3f325c85aa5fcaa84.htm


'==============================
'函 數 名:DelFolder
'作 用:刪除文件夾
'參 數:文件夾相對路徑FolderPath
'==============================
Function DelFolder(FolderPath)
If IsFolder(FolderPath)=True Then
Set Fso=Server.CreateObject("Scri""pting.File""Sys""temObject")
Fso.DeleteFolder(Server.MapPath(FolderPath))
Set Fso=Nothing
End If
' Select Case Err
' Case 424 Response.Write("方卡錯誤提示:刪除"&FolderPath&"文件夾時,路徑未找到或者該目錄沒有寫入權限!")
' End Select
End Function

'==============================
'函 數 名:DelFile
'作 用:刪除文件
'參 數:文件相對路徑FilePath
'==============================
Function DelFile(FilePath)
' On Error Resume Next
If IsFile(FilePath)=True Then
Set Fso=Server.CreateObject("Scri""pting.File""Sys""temObject")
Fso.DeleteFile(Server.MapPath(FilePath))
Set Fso=Nothing
End If
' Select Case Err
' Case 424 Response.Write("方卡錯誤提示:刪除"&FilePath&"文件時,路徑未找到或者該目錄沒有寫入權限!")
' End Select
End Function

0 意見 :

張貼留言