Operating System - HP-UX
1834206 Members
2231 Online
110066 Solutions
New Discussion

Preserving File Date Attributes

 
SOLVED
Go to solution
Bill Brutzman
Frequent Advisor

Preserving File Date Attributes

When copying source-code files from server-to-server, it would be great if the date that the files were originally created could be preserved.

Of course, if I just brute-force rcp the files, the destination copied files will have today's date.

Suggestions would be appreciated.
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor
Solution

Re: Preserving File Date Attributes

Hi Bill:

Simply add the '-p' option to your 'rcp'.

Regards!

...JRF...
Peter Nikitka
Honored Contributor

Re: Preserving File Date Attributes

Hi Bill,

note that a 'rcp -p' will possibly not only preserve the timestamp but the owner, group and access mode as well (permissions granted). The scp-command will handle that option the same way.

There is no option to get an identical timestamp only; further processing is required.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Coolmar
Esteemed Contributor

Re: Preserving File Date Attributes

I though -p will preserve the timestamp? From the man pages:

-p Preserve (duplicate) modification times and modes(permissions) of source files, ignoring the current setting of the umask file creation mode mask. If this option is specified, rcp preserves the sticky bit only if the target user is superuser.
Peter Nikitka
Honored Contributor

Re: Preserving File Date Attributes

Hi Coolmar,

>> -p Preserve (duplicate) modification times and modes(permissions)
<<

look at this:
and modes(permissions)
!

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Bill Brutzman
Frequent Advisor

Re: Preserving File Date Attributes

Thanks to those who responded.