Copy date from a file to another

 

 

The last parameter (FALSE in the example), is if you want error if the destination file exists :

 

Procedure CopyFileDate ( Const Source , Dest : String ) ;

Var

   SourceHand , DestHand : word ;

Begin

   SourceHand := FileOpen ( Source , fmOpenRead ) ; { open source file }

   DestHand := FileOpen ( Dest , fmOpenWrite ) ; { open dest file }

   FileSetDate ( DestHand , FileGetDate ( SourceHand ) ) ; { get/set date }

   FileClose ( SourceHand ) ; { close source file }

   FileClose ( DestHand ) ; { close dest file }

End ;


Back Home Foward