Professional Documents
Culture Documents
Command FileExists - Delphi
Command FileExists - Delphi
SysUtils unit
Description
The FileExists function returns True if the given FileName file exists.
False may be returned if the user is not authorised to see the file.
var
fileName : string;
myFile : TextFile;
data : string;
begin
// Try to open a text file for writing to
fileName := 'Test.txt';
AssignFile(myFile, fileName);
ReWrite(myFile);
Hello World
Test.txt exists OK
Test.txt no longer exists