We are trying to save files preserving the date and time stamps for archive purposes.
Based on our experience the date/time is modified to reflect the date/time of the "copy file" command.
Is there an easy way to copy files preserving the original date and time stamps?
copy files preserving date time stamps
- don lowenstein
- Posts: 196
- Joined: Mon Oct 17, 2005 9:09 pm
- Contact:
copy files preserving date time stamps
Don Lowenstein
www.laapc.com
www.laapc.com
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: copy files preserving date time stamps
CopyFile() preserves date and time stamps:
EMG
Code: Select all
DLL FUNCTION COPYFILE( cExistingFileName AS LPSTR, cNewFileName AS LPSTR, lFailIfExists AS LONG ) AS BOOL;
PASCAL FROM "CopyFileA" LIB "kernel32.dll"
Re: copy files preserving date time stamps
see also:
---------------
SetFDaTi() - Sets the last change date and time of a file.
Syntax
SetFDaTi( <cFileName> , ;
[<dFileDate>], ;
[<cFileTime>] ) --> lSuccess
Arguments
<cFileName>
This is a character string holding the name of the file to set date and time for. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory only.
<dFileDate>
This is the date value to be set. It defaults to the return value of Date().
<cFileTime>
This is a time formatted string that defines the new file time. It defaults to Time(). Return
The function returns .T. (true) if the file date and time is set, otherwise .F. (false) is returned.
-------------------
In my copy-function I'm using 'SetFDaTi( cTargetFile, FileDate( cSourceFile ), FileTime( cSourceFile ) )'
HTH
---------------
SetFDaTi() - Sets the last change date and time of a file.
Syntax
SetFDaTi( <cFileName> , ;
[<dFileDate>], ;
[<cFileTime>] ) --> lSuccess
Arguments
<cFileName>
This is a character string holding the name of the file to set date and time for. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory only.
<dFileDate>
This is the date value to be set. It defaults to the return value of Date().
<cFileTime>
This is a time formatted string that defines the new file time. It defaults to Time(). Return
The function returns .T. (true) if the file date and time is set, otherwise .F. (false) is returned.
-------------------
In my copy-function I'm using 'SetFDaTi( cTargetFile, FileDate( cSourceFile ), FileTime( cSourceFile ) )'
HTH
- don lowenstein
- Posts: 196
- Joined: Mon Oct 17, 2005 9:09 pm
- Contact:
Re: copy files preserving date time stamps
Thank you Enrico - That works great
Don Lowenstein
www.laapc.com
www.laapc.com