Thanks for the clarification Sergey. Best regards, Luis
On Fri, 24 May 2019 at 18:58, Sergey Poznyakoff <[email protected]> wrote: > Hi, > > > ln -s /tmp/test/subfolder/dummyfile /tmp/test/subfolder/dummyfile-symlink > > cd /tmp/test/ > > find ./subfolder-symlink/ > files.txt > > There are several problems with the archive created this way. First of > all, it does not contain the entry for the directory subfolder-symlink > points to (that's the reason of the first error during extraction). > Secondly, symbolic links refer to absolute path names. So, if you use > the -P option while extracting: > > tar -Pzxvf corrupted-tar.tar.gz > > then it will extract fine, provided that the target directory exist. But > that's probably not what you want. > > The proper way to create the archive in this case would be to (1) add > the subfolder entry to files.txt, (2) to use the --no-recursion option > to avoid descending into it and (3) to transform absolute links to > relative ones. E.g.: > > basename $(readlink ./subfolder-symlink) > files.txt > find ./subfolder-symlink/ >> files.txt > tar --no-recursion --transform 's|/tmp/test/||' \ > -S -c -T files.txt -zf uncompress-folder/corrupted-tar.tar.gz > > Regards, > Sergey > >
