Gentoo Archives: gentoo-user

From: Walter Dnes <waltdnes@××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] tar exclude syntax tip
Date: Wed, 05 May 2021 15:28:37
Message-Id: YJK5oG/tWNxEWuh+@waltdnes.org
In Reply to: Re: [gentoo-user] [OT] tar exclude syntax tip by tastytea
1 On Wed, May 05, 2021 at 04:03:03PM +0200, tastytea wrote
2 >
3 > This works fine here with ???tar (GNU tar) 1.34???:
4 >
5 > $ mkdir -p a/b
6 > $ touch a/file a/b/file
7 > $ touch a/file.xz a/b/file.xz
8 > $ tree a
9 > a
10 > ????????? b
11 > ???   ????????? file
12 > ???   ????????? file.xz
13 > ????????? file
14 > ????????? file.xz
15 >
16 > 1 directory, 4 files
17 > $ tar -cvzf test.tar.gz --exclude="a/file" --exclude="a/b/*.xz" a
18
19 That's files. What happens with directories, e.g.
20 tar -cvzf test.tar.gz --exclude="a/b/" a
21
22 I know I followed the manual. Actually, my problem seems to be with
23 directories. See
24 https://serverfault.com/questions/742514/running-the-tar-command-with-the-exclude-functionality-does-not-work-for-direc
25 where someone finds that...
26
27 tar hczf t.tar.gz * --exclude="./test1"
28
29 ...doesn't work, but...
30
31 tar --exclude="./test1" -hczf t.tar.gz *
32
33 ...does work!?!?!?
34
35 --
36 Walter Dnes <waltdnes@××××××××.org>
37 I don't run "desktop environments"; I run useful applications

Replies

Subject Author
Re: [gentoo-user] [OT] tar exclude syntax tip tastytea <gentoo@××××××××.de>