ASP DeleteFile Method
Definition and Usage
The DeleteFile method deletes one or more specified files.
Note:If you try to delete a non-existent file, an error will occur.
Syntax:
FileSystemObject.DeleteFile(filename[,force])
Parameter | Description |
---|---|
filename | Required. The name of the file to be deleted (wildcards can be used). |
force | Optional. Indicates whether a read-only file can be deleted. True indicates that read-only files can be deleted, while False indicates that read-only files cannot be deleted. The default is False. |
Instance
<% 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 %>