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 know this question was previously asked on this site before like here 1 and here 2 but no success for me.

I want to extract the Measures folder from my S012011_csv.tar.gz zipped file. If I do tar -ztvf file.tar.gz to see the content, you can see the folder directory structure:

global//scratch//chamar//data//S012011_csv/Measures/file1.csv

global//scratch//chamar//data//S012011_csv/Measures/file2.csv

and so on (yes there are //).

I only want to extract the subfolder Measures under folder S012011_csv in the current directory of the .tar.gz folder.

I have tried all these options but no success:

tar -xvzf S012011-v41_csv.tar.gz --strip=6 ./global//scratch//chamar//book//S012011-v41_csv/Mearsures/*

tar -xvzf S012011-v41_csv.tar.gz --strip=6 global//scratch//chamar//book//S012011-v41_csv/Mearsures/*

tar -xvzf S012011-v41_csv.tar.gz --strip=6 global/scratch/chamar/book/S012011-v41_csv/Mearsures/*

tar -xvzf S012011-v41_csv.tar.gz global/scratch/chamar/book/S012011-v41_csv/Mearsures/*

What am I doing wrong?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Try this:

tar -xvzf S012011-v41_csv.tar.gz "*S012011-v41_csv*Mearsures*"
share|improve this answer
    
It doesn't do anything. If I keep the -v option it only prints on screen the content of my folder Measures. Thanks for the suggestion. –  CharlesM Apr 27 at 20:09
    
Try adding the --strip-path argument for removing all directories before and after the files you want to extract. I think the double slash could have something to do with this. –  drk.com.ar Apr 27 at 21:39
    
nope... I get this: *S012011-v41_csv*Mearsures*: Not found in archive tar: Error exit delayed from previous errors –  CharlesM Apr 27 at 22:04
    
I think you are right... the // is the problem... how can I bypass this? –  CharlesM Apr 27 at 22:42
    
I don't know. My bet was trying to make tar not use the double slashes in the output file name. But seems not to be working. –  drk.com.ar Apr 27 at 22:53

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.