System.SysUtils.DirectoryExists
Delphi
function DirectoryExists(const Directory: string; FollowLink: Boolean = True): Boolean;
C++
extern DELPHI_PACKAGE bool __fastcall DirectoryExists(const System::UnicodeString Directory, bool FollowLink = true);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.SysUtils.pas System.SysUtils.hpp |
System.SysUtils | System.SysUtils |
Description
Determines whether a specified directory exists.
Call DirectoryExists to determine whether the directory specified by the Directory
parameter exists. If the directory exists, the function returns True. If the directory does not exist, the function returns False.
If a full path name is entered, DirectoryExists searches for the directory along the designated path. Otherwise, the Directory
parameter is interpreted as a relative path name from the current directory.
Note: If the Directory parameter is a symbolic link and the FollowLink parameter is set to True, the method is performed on the target directory. If the first condition is True, but the FollowLink parameter is set to False, the method will be performed on the symbolic link. If the link is broken, the method will always return False.
Note: The Vcl.FileCtrl unit (Windows only) also contains a DirectoryExists function. However, the Vcl.FileCtrl version is deprecated, and the System.SysUtils version is preferred and can be used in multi-device applications.
Method behavior if the Directory parameter is a directory:
Target Exists | FollowLink | Method result |
---|---|---|
YES |
True |
True |
YES |
False |
True |
NO |
True |
False |
NO |
False |
False |
Method behavior if the Directory parameter is a symbolic link:
Target Exists | FollowLink | Method result |
YES |
True |
True |
YES |
False |
True |
NO |
True |
False |
NO |
False |
True |
See Also