28 lines
875 B
Plaintext
28 lines
875 B
Plaintext
example usage:
|
|
Deletes file.txt In directory New Folder off C drive's root.
|
|
<% Kill "C:New Folderfile.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") & "*" %>
|
|
source code:
|
|
<%
|
|
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
|
|
%> |