Kill pathname
Example Usage:
ASP Source Code:Deletes file.txt in directory New Folder off C drive's root. <% Kill "C:\New Folder\file.txt" %> Deletes file.txt in directory New Folder off the server's root. <% Kill server.mappath("/New Folder/file.txt") %> Deletes all files in directory New Folder off the C drive's root. <% Kill "C:\New Folder\*" %> Deletes all files in directory New Folder off the server's root. <% Kill server.mappath("/New Folder") & "\*" %>
<% Private Sub Kill(byVal pathname) Dim objFSO, boolErr, strErrDesc On Error Resume Next Set objFSO = Server.CreateObject("scripting.filesystemobject") objFSO.DeleteFile pathname if Err Then boolErr = True strErrDesc = Err.Description end if Set objFSO = Nothing On Error GoTo 0 if boolErr then Err.Raise 5102, "Kill Statement", strErrDesc End Sub %>