directory times not restored

View: New views
3 Messages — Rating Filter:   Alert me  

directory times not restored

by Jeph Cowan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi cpio maintainers.

I've restored a file system from archived tapes using

  cpio -icvdm < archive

The modification date/times of the files are maintained as original, but the
date/time of the directories is the date/time of the restore. Is there a way to
restore the directory with the original directory modification time? It seems that
this may not be possible as the act of putting(restoring) the files into the
directory is in fact a modification. Just thought I'd ask. Thanks in advance.

Regards... -jeph

--
jeph Cowan
Supercomputer Systems Group
National Center for Atmospheric Research
1850 Table Mesa Drive
Boulder, CO 80305
303-497-1294
jeph@...


_______________________________________________
Bug-cpio mailing list
Bug-cpio@...
http://lists.gnu.org/mailman/listinfo/bug-cpio

Re: directory times not restored

by Sergey Poznyakoff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jeph,

> The modification date/times of the files are maintained as original, but the
> date/time of the directories is the date/time of the restore. Is there a way to
> restore the directory with the original directory modification time?

Yes, use the -m (--preserve-modification-time) command line option.

Regards,
Sergey


_______________________________________________
Bug-cpio mailing list
Bug-cpio@...
http://lists.gnu.org/mailman/listinfo/bug-cpio

Re: directory times not restored

by Tim Kientzle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jeph Cowan wrote:
>
> The modification date/times of the files are maintained as original,
> but the date/time of the directories is the date/time of the restore.

What version?

I seem to recall Sergey fixing this in GNU cpio
fairly recently.

> It seems that this may not be possible as the act of putting(restoring)
> the files into the directory is in fact a modification.

It is tricky to implement.  The technique I used for
libarchive (which I believe is the same technique
Sergey used for GNU cpio) is to keep a list in memory
of directories and mtimes and then set the mtimes at
the very end, after all of the files have been written.
The same technique can be used to correctly restore
directories that are not writable or which have
restrictive file flags or ACLs.

Tim


_______________________________________________
Bug-cpio mailing list
Bug-cpio@...
http://lists.gnu.org/mailman/listinfo/bug-cpio