[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-tar] Listing (tv) with strip-components does not work as expected
From: |
Vincent Legoll |
Subject: |
[Help-tar] Listing (tv) with strip-components does not work as expected |
Date: |
Mon, 28 Aug 2017 12:03:02 +0200 |
I tried to use "--strip-components=1" alongside "-tv" to see if
it will do what I want, but it does not strip...
mkdir -p a/b/c
touch a/b/c/toto.txt
tar -cf a.tar a
tar -tvf a.tar
drwx------ vince/vince 0 2017-08-28 11:52 a/
drwx------ vince/vince 0 2017-08-28 11:52 a/b/
drwx------ vince/vince 0 2017-08-28 11:52 a/b/c/
-rw------- vince/vince 0 2017-08-28 11:52 a/b/c/toto.txt
tar --strip-components=1 -tvf a.tar
drwx------ vince/vince 0 2017-08-28 11:52 a/
drwx------ vince/vince 0 2017-08-28 11:52 a/b/
drwx------ vince/vince 0 2017-08-28 11:52 a/b/c/
-rw------- vince/vince 0 2017-08-28 11:52 a/b/c/toto.txt
I would have expected something like that:
drwx------ vince/vince 0 2017-08-28 11:52 b/
drwx------ vince/vince 0 2017-08-28 11:52 b/c/
-rw------- vince/vince 0 2017-08-28 11:52 b/c/toto.txt
The listing problem also happens with extraction, despite the extraction
honoring the strip-component param:
tar --strip-components=1 -xvf a.tar
a/b/
a/b/c/
a/b/c/toto.txt
ls -lR b
b:
total 4
drwx------ 2 vince vince 4096 Aug 28 11:52 c
b/c:
total 0
-rw------- 1 vince vince 0 Aug 28 11:52 toto.txt
Is that the intended behavior ?
If yes, maybe adding a small warning to the man page may
avoid the confusion:
The man page has this:
--strip-components=NUMBER
Strip NUMBER leading components from file names on extraction.
So it's technically right, and sufficient, but...
--
Vincent Legoll
- [Help-tar] Listing (tv) with strip-components does not work as expected,
Vincent Legoll <=