Delete a folder, expects to be an empty folder, path must be already MapPathed
<%
Private Sub RmDir(byVal path)
Dim objFSO, boolErr, strErrDesc
boolErr = False
On Error Resume Next
Set FSO = Server.CreateObject("scripting.filesystemobject")
FSO.DeleteFolder path
if Err Then
boolErr = True
strErrDesc = Err.Description
end if
Set FSO = Nothing
On Error GoTo 0
if boolErr then Err.Raise 5100, "RmDir Statement", strErrDesc
End Sub
% >
Private Sub RmDir(byVal path)
Dim objFSO, boolErr, strErrDesc
boolErr = False
On Error Resume Next
Set FSO = Server.CreateObject("scripting.filesystemobject")
FSO.DeleteFolder path
if Err Then
boolErr = True
strErrDesc = Err.Description
end if
Set FSO = Nothing
On Error GoTo 0
if boolErr then Err.Raise 5100, "RmDir Statement", strErrDesc
End Sub
% >
path
<% RmDir "C:\New Folder" %>
<% RmDir server.mappath("/New Folder") %>
<% RmDir server.mappath("/New Folder") %>
Views 5,372
Downloads 1,544
CodeID
DB ID