ASP FileExistsMethod


FileSystemObject 对象参考手册Complete FileSystemObject Object Reference Manual

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

Syntax

FileSystemObject.FileExists(filename)

Parameters Description
filename Required. The name of the file to check for existence.


Example

<%
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists("c:\asp\introduction.asp") 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
%>


FileSystemObject 对象参考手册Complete FileSystemObject Object Reference Manual Other Extensions