Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ASP DeleteFile Method

ASP DeleteFile Method


FileSystemObject Reference Complete FileSystemObject object reference manual


The DeleteFile method deletes one or more specified files.

**Note:** If you try to delete a file that does not exist, an error occurs.

Syntax

FileSystemObject.DeleteFile(filename[,force])

Parameters Description
filename Required. The name of the file(s) to delete (wildcards can be used).
force Optional. A Boolean value indicating whether read-only files can be deleted. True indicates read-only files can be deleted; False indicates they cannot. 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

%>


FileSystemObject Reference Complete FileSystemObject object reference manual