FileAge function
Return the timestamp of a file.
Declaration
function FileAge(const FileName: UnicodeString): Int64Description
FileAge in it's simplest form returns the last modification time of file
FileName as an opaque os-dependent file timestamp.
In this case, the return value can be transformed to a
TDateTime value with the
FileDateToDateTime function.
In case a FileDateTime argument is supplied, the FileAge function will do the transformation by itself, and the
file time will be returned in the FileDateTime argument as a TDateTime value.
The function return value is then a boolean indicating success or failure.
The FollowSymlink parameter can be set to False to read the timestamp of a symbolic link,
instead of the timestamp of the file the symbolic link points to (which is the default behaviour).
FileAge cannot be used on directories, it will return -1 (or False) if FileName indicates a directory.
Errors
In case of errors,
-1 or
False is returned.
See also
Example: ex36
Program Example36;
{ This program demonstrates the FileAge function }
Uses sysutils;
Var S : TDateTime;
fa : Longint;
Begin
fa:=FileAge('ex36.pp');
If Fa<>-1 then
begin
S:=FileDateTodateTime(fa);
Writeln ('I''m from ',DateTimeToStr(S))
end;
End.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
