On 02/08/2015 12:53 AM, Manish Jain wrote:
Hi,
I am having problems trying to understand why does tar archive differently with the following 2 commands, presuming xyz is a sub-directory :
tar -c -f - ./xyz | gzip > xyz.tar.gz//xyz nested one level under . and .. tar -c -f - xyz | gzip > xyz.tar.gz//no . or ..
With the first invocation, I get a top-level nesting that just has . and .. With the second, I get a top-level nesting that has xyz, which is much preferable
The first invocation leads to an absurdity that you have to cd into . (sounds recursively impossible) to actually get to xyz
Thanks for any help.
So, what do you see to be the huge difference:
$ tar cf - ./xyz | gzip > xyz1.tar.gz $ tar cf - xyz | gzip > xyz2.tar.gz
$ tar ztvf xyz1.tar.gz drwxr-xr-x jd/jd 0 2015-02-08 11:12 ./xyz/ -rw-r--r-- jd/jd 18 2015-02-08 11:13 ./xyz/c -rw-r--r-- jd/jd 18 2015-02-08 11:13 ./xyz/b -rw-r--r-- jd/jd 18 2015-02-08 11:12 ./xyz/a
$ tar ztvf xyz2.tar.gz drwxr-xr-x jd/jd 0 2015-02-08 11:12 xyz/ -rw-r--r-- jd/jd 18 2015-02-08 11:13 xyz/c -rw-r--r-- jd/jd 18 2015-02-08 11:13 xyz/b -rw-r--r-- jd/jd 18 2015-02-08 11:12 xyz/a