Posted By

icebob on 08/02/10


Tagged


Versions (?)

Set file date


 / Published in: Delphi
 

  1. function SetFileDate(FileName : String; FileDate : TDateTime): Boolean;
  2. var
  3. FileHandle : THandle;
  4. FileSetDateResult : Integer;
  5. begin
  6. try
  7. FileHandle := FileOpen(FileName, fmOpenWrite OR fmShareDenyNone);
  8. if FileHandle > 0 Then
  9. begin
  10. FileSetDateResult := FileSetDate(FileHandle, DateTimeToFileDate(FileDate));
  11. result := (FileSetDateResult = 0);
  12. end;
  13. FileClose(FileHandle);
  14. except
  15. Result := False;
  16. end;
  17. end;

Report this snippet  

You need to login to post a comment.