Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to wget a tarball from github.com and, without creating a temporary file, extract a subdirectory from it:


wget -qO- https://github.com/django-nonrel/django-nonrel/tarball/develop | tar xzf - django

It gives me an error saying:


tar: django: Not found in archive
tar: Exiting with failure status due to previous errors

Apparently I am doing something wrong.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Since the django directory itself is a subdirectory of the resulting gzip content, you'll need to use the --strip-components=1 option of GNU tar. Assuming you're using GNU tar. Then you need to tell tar that you're looking for a subdirectory called django.

wget -qO- https://github.com/django-nonrel/django-nonrel/tarball/develop | tar --strip-components=1 -zxf - \*/django

FWIW, I also had to use the --no-check-certificate option of wget.

share|improve this answer
    
thanks. that worked. I had to add --wildcards option as well. –  akonsu Sep 5 '12 at 20:06

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.