1

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?

Ünsal Korkmaz
  • 63
  • 3
  • 12

2 Answers2

1

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.

user9517
  • 114,104
  • 20
  • 206
  • 289
  • In addition, `tar` continues reading through the entire file even once it has found the files you want to extract. – Ladadadada Mar 08 '12 at 18:14
0

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.

sciurus
  • 12,493
  • 2
  • 30
  • 49
  • 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 01:55
  • Looking more closely at the tar format, I see that this would be a problem even if it wasn't gzipped. http://en.wikipedia.org/wiki/Tar_(file_format)#Random_access – sciurus Apr 26 '11 at 02:50