Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to change the path of extraction of a .tar.gz archive. The files are supposed to extract as ./1/2/3/4/files, ./1/2/3files and so on.

The .1/2 part of those is common to all the files.

My question is, how can I modify the extraction path to extract into ./2/ and completely ignore the 1 directory?

share|improve this question
2  
I assume Linux, but tagging the OS would probably be a good idea too. –  EBGreen Feb 13 '12 at 20:20

1 Answer 1

Generally you use the --strip-components=n option for this using gnu tar. It strips n leading directories from the paths.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.