Operating System - HP-UX
1832802 Members
3393 Online
110045 Solutions
New Discussion

tar restore time/date stamp

 
SOLVED
Go to solution
Rick Gleadell
New Member

tar restore time/date stamp

When restoring a xxx.tar file, the time/date for restored files matches the time/date stamp of the original file.

But for directories, the time/date stamp is the time the restore (tar xf) is executed.

Any way to retain the last modified date for directories?
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: tar restore time/date stamp

Hi Rick:

I think that you are stuck with the fact that the 'mtime' of a restored directory will reflect the 'tar' extraction time anytime the directory requires creation or anytime the *contents* of the directory are changed (e.g. by the restoration).

Regards!

...JRF...
Jeff Schussele
Honored Contributor

Re: tar restore time/date stamp

Hi Rick,

AFAIK, no.
If you think about it when the dir entry is first extracted it will have the original date/time stamp.
BUT as soon as you start extracting files into it you are modifying it. Therefore it's date/time stamp *must* change.

So the only way to keep the previous date/time stamp is to extract only an empty dir.

I suppose you could extract the date/time value as it's backed up and store it somewhere & then use the touch -t with the saved value to reset it back. But tar, cpio, even pax cannot do this for you as they are written.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!