public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: tastytea <gentoo@tastytea.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] [OT] tar exclude syntax tip
Date: Wed, 5 May 2021 18:00:07 +0200	[thread overview]
Message-ID: <20210505180007.767951e7@ventiloplattform.tastytea.de> (raw)
In-Reply-To: <YJK5oG/tWNxEWuh+@waltdnes.org>

[-- Attachment #1: Type: text/plain, Size: 1469 bytes --]

On 2021-05-05 11:28-0400 "Walter Dnes" <waltdnes@waltdnes.org> wrote:

> On Wed, May 05, 2021 at 04:03:03PM +0200, tastytea wrote
> > 
> > This works fine here with ???tar (GNU tar) 1.34???:
> > 
> > $ mkdir -p a/b
> > $ touch a/file a/b/file
> > $ touch a/file.xz a/b/file.xz
> > $ tree a
> > a
> > ????????? b
> > ???   ????????? file
> > ???   ????????? file.xz
> > ????????? file
> > ????????? file.xz
> > 
> > 1 directory, 4 files
> > $ tar -cvzf test.tar.gz --exclude="a/file" --exclude="a/b/*.xz" a  
> 
>   That's files.  What happens with directories, e.g.
> tar -cvzf test.tar.gz --exclude="a/b/" a

With the trailing slash it doesn't work, but
`tar -cvzf test.tar.gz --exclude="a/b" a` works.

>   I know I followed the manual.  Actually, my problem seems to be with
> directories.  See
> https://serverfault.com/questions/742514/running-the-tar-command-with-the-exclude-functionality-does-not-work-for-direc
> where someone finds that...
> 
> tar hczf t.tar.gz * --exclude="./test1"
> 
> ...doesn't work, but...
> 
> tar --exclude="./test1" -hczf t.tar.gz *
> 
> ...does work!?!?!?
> 

That's because the files come last, the poster of the question has put
--exclude after the files.

When I'm in a, --exclude="./b" doesn't work, but --exclude="b" works.
tar doesn't seem to understand “./”.

-- 
Get my PGP key with `gpg --locate-keys tastytea@tastytea.de` or at
<https://tastytea.de/tastytea.asc>.

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2021-05-05 16:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 13:33 [gentoo-user] [OT] tar exclude syntax tip Walter Dnes
2021-05-05 14:03 ` tastytea
2021-05-05 14:10   ` [gentoo-user] " Nuno Silva
2021-05-05 14:23     ` tastytea
2021-05-05 15:28   ` [gentoo-user] " Walter Dnes
2021-05-05 16:00     ` tastytea [this message]
2021-05-05 15:20 ` Grant Taylor
2021-05-06  0:07 ` Frank Steinmetzger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505180007.767951e7@ventiloplattform.tastytea.de \
    --to=gentoo@tastytea.de \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox