during unpacking with tar hide the error message: 'tar: Removing leading `/' from member names' for archive created with --absolute-names

It is not duplicate, other questions on stackexchange are about getting rid of this message as archive is created.

Is it possible, given archive that was created with -P option (with leading `/')?

I have an archive created with "--absolute-names" (-P option) - with leading /.

I want to unpack it, with / stripped (tar is doing it by default).

It is almost ideal, but I want to silence:

tar: Removing leading `/' from member names.

without removing other messages (so brute force in the form of 2>/dev/null is not a solution).

I found multiple solution how to silence this message during creating archive but none for unpacking. I know about grep -v but it will (a) hide error code from tar (b) add its own error code if message about / is not stripped.

This situation may be replicated with

cd /home/user/tmp
touch a.txt
mateusz@Grisznak:~/Desktop/tmp$ tar --create -P /home/user/tmp > a.tar
mateusz@Grisznak:~/Desktop/tmp$ tar --extract --file=a.tar 

To avoid XY problem: I am unpacking archives created by backup gem ().

3 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like