You are not logged in.
Hello,
I didnt found way, how can I copy file from tar to another tar without write files to disk.
Can you help? I think need pipe, but how?
Offline
tar -cf – <source directory> | (cd /<target directory>;tar -xf -)
Moving to Programming and Scripting for better answers...
Offline
I don't see this as possible. You can extract the file to stdout:
tar xzf --to-stdout source.tar.gz some/file.txt
But to create/append an archive, tar needs to know both the meta data (filename, permissions, owner, group etc) and the content of the file, which can't be passed through a single pipe together.
Last edited by fukawi2 (2013-03-07 04:47:50)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
how can I copy file from tar to another tar without write files to disk.
Why do you want to do this? I agree with fukawi2 that it is probably impossible. Do you want to avoid temporary files for efficiency reasons? /tmp is a RAM disk these days, so extracting a file there is going to be very fast.
Officer, I had to drive home - I was way too drunk to teleport!
Offline
Hello, thanks. Because I have some of tar from android, and I want mass them. I don't want extract, because of meta tags are changing. What can I do? Thanks
Offline
So if I understand correctly, you have several tar files from a different system and want to combine them to one big tar file containing all their contents. Right?
Have you tried the -A / --concatenate option of tar? I have never used it, but it looks like this is what it's for.
I am not entirely clear on what you mean by "meta tags". If you mean file system metadata like owner and group, you could use the --same-owner option when extracting (and create a different tar file of everything afterwards). This will probably require being root.
Officer, I had to drive home - I was way too drunk to teleport!
Offline
Thanks. I probed to concatenate but the size is doubled. Only I could to extract with. sudo tar --same-owner option, this seems to good, and than update the lastest package. But after the updated package owner is changed to root:root if I asked with tar -tvf option.
Im sad, but at now I never mind.
Offline