Am Freitag 25 Juni 2010, 17:55:38 schrieb bobby: > Hi @all, > > Is there in Linux any function to set file time (created/modified)? > I need it to set the file/directory time at unpacking ZIP archives.
As it happens, I had to use such a function for my patch engine ... all necessary functions and structs are in unit libc. My code to use them is: function SetFileTimesHelper(const FileName: string; const DateTime: TDateTime; Times: TFileTimes): Boolean; var FileTime: Integer; StatBuf: TStatBuf64; TimeBuf: utimbuf; begin Result := False; FileTime := DateTimeToFileDate(DateTime); if lstat64(PChar(FileName), @statBuf) = 0 then begin TimeBuf.actime := StatBuf.st_atime; TimeBuf.modtime := StatBuf.st_mtime; case Times of ftLastAccess: TimeBuf.actime := FileTime; ftLastWrite: TimeBuf.modtime := FileTime; end; Result := utime(PChar(FileName), @TimeBuf) = 0; end; end; (As you see, there is no Creation Time as in Windows. Only Access and Modified.) Best Regards, Andreas. -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus