It would be a simple matter to write your own library routine to replace FileExists. I would suggest using another name, like FileFound, to avoid confusion. I would suggest using FindFirst and return True if FindFirst succeeds and if FindFirst returns an error.
-----Original Message----- From: tim11g [SMTP:[email protected]] Sent: Wednesday, February 25, 2009 4:31 PM To: [email protected] Subject: [delphi-en] Re: Understanding different behavior with FindFirstFile and FindFirst --- In [email protected], "tim11g" <gro...@...> wrote: > > Now I get WinError 5 (Access Denied) when I try to change the date. > However, the file is not open or locked. > I figured it out - The Delphi help for FileSetDate fails to mention that is is necessary to open the file for writing (fmOpenWrite). I followed the source down to the underlying WinApi function, and the Windows SDK help for SetFileTime does say that "The file handle must have been created with GENERIC_WRITE access to the file" I still think the behavior of FileExists reporting False for files that exist but have very old dates is somewhat of a bug, or should at least be documented. (maybe it is by now - I'm still using D7)

