Thu 25 Jun 2009 07:58:47 PM UTC, original submission:
Problem: When extracting files from an archive, one sometimes needs to pipe them to another process as an archive. More specifically, one sometimes requires a subset of an archive, still in the form of an archive.
Example Problem: I have a 300GB archive on a machine called 'server'. I'd like to extract a very small subset of this archive (let's say 100MB) to a machine called 'client'. In this case, ownership and permissions are critical; therefore, temporary extraction onto the file system is impractical (translation: root won't be running the extraction.) Transmitting the entire archive across the network is even more impractical. At present, no standard program can solve this dilemma.
Solution: Patch 'tar' (or on your case, use my patch) to so it can export the headers when it extracts files to standard output. I added the option `--export-headers' (`-Q') to be used in conjunction with `--to-stdout' (`-O'). It will also work with `--to-command'.
Solution to Example: Because I have my new `--export-headers' option, the following allows me to extract a subset of the large archive across the network without any loss of archive information:
> tar -xOQf huge.tar smallfile | ssh me@client tar -x
(Realistically, it's a script on the other end; not 'tar' by itself.)
This simple patch solves what otherwise requires a horrendous solution. I hope you accept it! I'll certainly be using it, either way.
Kevin P. Barry [ta0kira@users.berlios.de]
PS I wrote this today and the diff should be against the most recent 'git' revision.
|