Open In App

ASP FileExists Method

The FileExists Method in ASP is used for returning the Boolean value which indicates that whether a particular file exists or not. It returns true means the particular file exits or returns false if the particular file not exits.  

Syntax:



FileSystemObject.FileExists(filename) 

Parameter Values:

Example: Below code demonstrates the FileExists Method.






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

Output:

File d:\hello\GFG.asp exists
Article Tags :