tar: Removing leading `../' from member names

I am testing out the functionality of tar by compressing and extracting directories as follows:

cd test
mkdir Documents
mkdir foo
cd foo
sudo tar cf - ../Documents | tar xf - 

The last command gives me the following error:

tar: Removing leading `../' from member names

I know that we need to force tar to take in absolute pathnames but this is a relative one. Why isn't tar accepting this argument?

1

1 Answer

From tar manpage:

-P, --absolute-names don't strip leading '/'s from file names

You should run:

sudo tar cPf - ../Documents | tar xPf -

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