Re: restoring a tar archive && modification time of directories
- In reply to: Jin Guojun[VFF]: "Re: restoring a tar archive && modification time of directories"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 02 May 2025 10:28:17 UTC
El día jueves, mayo 01, 2025 a las 11:58:42a. m. -0700, Jin Guojun[VFF] escribió: > On 5/1/25 11:33, Matthias Apitz wrote: > > I can reproduce the problem with: > > > > $ rm -r d > > $ mkdir d > > $ touch -t 202504300101 d/file d > > $ ls -ld d d/file > > drwxr-xr-x 2 guru wheel 512 30 abr. 01:01 d > > -rw-r--r-- 1 guru wheel 0 30 abr. 01:01 d/file > > $ tar cf d.tar d > > > > (without deleting the directory 'd') > > > > $ tar xf d.tar > > $ ls -ld d d/file > > drwxr-xr-x 2 guru wheel 512 1 may. 20:25 d > > -rw-r--r-- 1 guru wheel 0 30 abr. 01:01 d/file > > > > i.e. if the directories are existing (as it was in my original case > > restoring into my HOME a backup), the modification time of the directory > > will not be adjusted to the value in the tar archive. One could call > > this a bug or a feature. Don't know. > > > > matthias > > This is the original "tar" behavior, which does not restore the existing > directory timestamp. > > The "mv" command actually gradually changed behavior on restoring timestamp > since 12-R, if my memory services correct. > > ... I will repair this problem im my HOME partition. From the tar-listing I grep'ed out all directory lines (having a '/' at the end): drwxr-xr-x 0 guru wheel 0 1 Mai 08:15 guru/ drwx------ 0 guru wheel 0 10 Apr. 21:48 guru/.ssh/ drwxr-xr-x 0 guru wheel 0 1 Mai 07:40 guru/.config/ drwxr-xr-x 0 guru wheel 0 1 Mai 08:35 guru/.cache/ drwx------ 0 guru wheel 0 5 Dez. 2020 guru/.dbus/ drwxr-xr-x 0 guru wheel 0 5 Dez. 2020 guru/.kde/ ... 22300 lines... removed unnecessary data with vim, so the lines look like: 1 Mai 08:15 guru/ 10 Apr. 21:48 guru/.ssh/ 1 Mai 07:40 guru/.config/ 1 Mai 08:35 guru/.cache/ 5 Dez. 2020 guru/.dbus/ 5 Dez. 2020 guru/.kde/ ... and wrote a shell script (attached) to generate touch-commands from the data: touch -t 202505010101 'guru/' touch -t 202504100101 'guru/.ssh/' touch -t 202505010101 'guru/.config/' touch -t 202505010101 'guru/.cache/' touch -t 202012050101 'guru/.dbus/' touch -t 202012050101 'guru/.kde/' ... matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub An die deutsche Bundesregierung: Nein, meine Söhne geb' ich nicht für Ihren Krieg! Al Gobierno alemán: ¡No, no doy mis hijos para su guerra! To the German Government: No, I will not give my sons for your war!