help-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Avoiding multiple entries with the same name


From: Stefan Monnier
Subject: Avoiding multiple entries with the same name
Date: Tue, 15 Dec 2020 17:47:54 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

I'm using `--transform` to move all the files from a subdirectory to its
parent, something like

    tar cf ... '--transform-s|^foo/bar/|foo/|' ...

this works fine, except that I'm left with an entry for a directory
`foo/bar` (which remains empty, of course).  I can solve this problem
with:

    tar cf ... '--transform-s|^foo/bar\(/\|$\)|foo/|' ...

so the transform also applies to `foo/bar` itself, but then I end up
with two entries in the tarball for the `foo` directory.

Now, in practice it seems not to cause any problem, but I was wondering
is there was a way to remove this duplicate entry?
It also made me wonder if there'd be a way to use `--transform` in order
to *remove* (rather than rename) an entry (e.g. by renaming it to an
"impossible" name)?


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]