Recent

Author Topic: How read the creation date of a file  (Read 15255 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2261
    • Lazarus and Free Pascal italian community
How read the creation date of a file
« on: March 18, 2010, 10:46:51 am »
Hello guys, I need to know the creation date of a file? Does anyone know how?  :) :)
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Peter_Vadasz

  • New Member
  • *
  • Posts: 35
Re: How read the creation date of a file
« Reply #1 on: March 18, 2010, 12:22:50 pm »
In the BaseUnix unit there is an FpStat procedure. You can see it on the following link:
http://www.freepascal.org/docs-html/rtl/baseunix/fpstat.html
It works under Linux, but I don't know if it works under Windows.

ps. Sorry for my english
OS: Ubuntu 12.04.2 32 bit
Lazarus: 1.0.8
FPC: 2.6.2

clauslack

  • Sr. Member
  • ****
  • Posts: 275
Re: How read the creation date of a file
« Reply #2 on: March 18, 2010, 12:26:53 pm »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12894
  • FPC developer.
Re: How read the creation date of a file
« Reply #3 on: March 18, 2010, 12:38:09 pm »
Under Delphi, I use this (windows). Will work under FPC too probably.

Code: [Select]
function getcreationtime(fn:string;var v: TDateTime):Boolean;
var fl:TSearchRec;
begin
  result:=GetFileInformation(fn,fl);
  if result then
    v:=filetimetodatetime(fl.FindData.ftCreationTime);
end;

 

TinyPortal © 2005-2018