Any ideas how to change the time/date of a file on disk? I am copying from
one place to another, and want the time/date to remain the same as the
original. I have been trying:

var
  fh1, fh2: Cardinal;
  ft1, ft2, ft3: PFileTime;


fh2 := CreateFile(PChar(Dest), GENERIC_WRITE, FILE_SHARE_READ, Nil,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) ;
if fh2 <> INVALID_HANDLE_VALUE then
begin
  fh1 := CreateFile(PChar(Source), GENERIC_READ, FILE_SHARE_READ, Nil,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) ;
  if fh1 <> INVALID_HANDLE_VALUE then
    if GetFileTime(fh1, ft1, ft2, ft3) then
      SetFileTime(fh2, ft1, ft2, ft3) ;
  CloseHandle(fh1) ;
end ;
CloseHandle(fh2) ;

But It does nothing at all.
I am using Blockread/write so I can show a progress bar. Some of the files a
very large.

Cheers,
Dave.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to