ASP DeleteFileMethod
Complete FileSystemObject Object Reference Manual
The DeleteFile method deletes one or more specified files.
Note:An error will occur if you attempt to delete a file that does not exist.
Syntax
FileSystemObject.DeleteFile(filename[,force])
| Parameter | Description |
|---|---|
| filename | Required. The name of the file to delete (wildcards can be used). |
| force | Optional. A Boolean value indicating whether read-only files can be deleted. True indicates that read-only files can be deleted, False indicates that read-only files cannot be deleted. The default is False. |
Example
<%
dim fs
Set fs=Server.CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile("c:\test.txt",True)
if fs.FileExists("c:\test.txt") then
fs.DeleteFile("c:\test.txt")
end if
set fs=nothing
%>
dim fs
Set fs=Server.CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile("c:\test.txt",True)
if fs.FileExists("c:\test.txt") then
fs.DeleteFile("c:\test.txt")
end if
set fs=nothing
%>
Complete FileSystemObject Object Reference Manual Other Extensions