ASP FileExists Method

Definition and Usage

The FileExists method returns a Boolean value indicating whether the specified file exists. If it exists, it returns True, otherwise it returns False.

Syntax:

FileSystemObject.FileExists(filename)
parameter description
filename is required. It needs to check the name of the file that exists.

instance

<%
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists("c:\asp\introduction.asp")=true then
  response.write("File c:\asp\introduction.asp exists!")
else
   response.write("File c:\asp\introduction.asp does not exist!")
end if
set fs=nothing
%>