Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Lets say i have a big backup.tar.gz file in a remote ftp server. I needed some files from it but i dont want to download/untar all of it. Just specific files/folder. normally this is code to select files from a tar.gz file:

tar zxf backup.tar.gz /the/file/you/want

but.. from ftp server without downloading it? Is it possible?

share|improve this question
add comment

2 Answers

This is not possible. To extract a specific file from the tar file you will fist have to extract the the tar file from the .gz file. To do this you will have to read the whole .gz file. Once you've done this you still have to read the tar file sequentially to find the start of the file you want to extract.

share|improve this answer
    
In addition, tar continues reading through the entire file even once it has found the files you want to extract. –  Ladadadada Mar 8 '12 at 18:14
add comment

It might be possible using CurlFtpFS. You would have to verify that it does not download the entire tar file when you operate on it.

share|improve this answer
    
The entire tar (up to the end of the last file) must be downloaded for the files to be extracted due to the compression. –  Ignacio Vazquez-Abrams Apr 26 '11 at 1:55
    
Looking more closely at the tar format, I see that this would be a problem even if it wasn't gzipped. en.wikipedia.org/wiki/Tar_(file_format)#Random_access –  sciurus Apr 26 '11 at 2:50
add comment

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.