System.SysUtils.FileExists

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function FileExists(const FileName: string; FollowLink: Boolean = True): Boolean;

C++

extern DELPHI_PACKAGE bool __fastcall FileExists(const System::UnicodeString FileName, bool FollowLink = true);

Properties

Type Visibility Source Unit Parent
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils

Description

Tests whether a specified file exists.

FileExists returns True if the file specified by FileName exists. If the file does not exist, FileExists returns False.

Note: If the FileName parameter is a symbolic link and the FollowLink parameter is set to True, the method is performed on the target file. If the first condition is True, but the FollowLink parameter is set to False, the symbolic link is used, regardless whether the link is broken (the target file is invalid).


Method behavior if the FileName parameter is a file:

File Exists FollowLink Method result

YES

True

True

YES

False

True

NO

True

False

NO

False

False


Method behavior if the FileName parameter is a symbolic link:

Target Exists FollowLink Method result

YES

True

True

YES

False

True

NO

True

False

NO

False

True


See Also


Code Examples