Open In App

ASP DeleteFile Method

The ASP DeleteFile Method is used to delete one or more files from the server. It returns an error if we want to delete a non-existing file. 

Syntax:



FileSystemObject.DeleteFile(filename[,force])

Parameter Values:

Example: Below example demonstrates the DeleteFile Method. 






<%
dim fs
Set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists("c:\pictures\a.txt") then
response.write("Exist file ")
 fs.DeleteFile("c:\pictures\a.txt")
 response.write("is Deleted")
end if
set fs=nothing
%>

Output:

Exist file is Deleted
Article Tags :