TDirectory.GetLastAccessTime获取指定目录最后访问时间

使用函数:

  System.IOUtils.TDirectory.GetLastAccessTime

函数定义:

class function GetLastAccessTime(const Path: string): TDateTime; static;

说明: 参数为指定目录,返回最后一次访问时间(每次访问了某个目录如果下次不在访问,则都属于最后一次访问)

异常处理:指定目录不存在或无效

示例:

var
    sDir: string;
begin
    if not SelectDirectory('', 'H:	mp', sDir) then Exit;
    try
        Edit_Time.Text := DateTimeToStr(TDirectory.GetLastAccessTime(sDir));
    except
        on e: Exception do
        begin
            MessageDlg(e.ClassName + e.Message, mtError, [mbok], 0);
            Exit;
        end;
    end;

end;

原文地址:https://www.cnblogs.com/cause/p/3500175.html