TAR subdirectory question
Hi all.
I'm working with an already existing TAR file and I'm trying to insert a file into a subfolder of the TAR archive. Is there a simple way to do this? I don't want to put it in the directory where the TAR is pointing and archive again because it is a long process to archive everything; I want to put it directly into the subfolder of the TAR. I want to do something like: tar -cf test.tar:/subfolder text.txt Thanks |
Try calling tar with command "r" (append):
Code:
tar rf test.tar subfolder/text.txt |
Quote:
I meant to use an r in my original message instead of c. Something like tar rf test.tar:/subfolder text.txt |
Ok, then try that:
Code:
tar rf test.tar --transform 's%^%subfolder/%' test.txt |
When I do that I get the following. I created test.tar and test.txt to try it.
sh-3.2$ tar rf test.tar --transform 's%^%subfolder/%' test.txt tar: unrecognized option `--transform' Try `tar --help' or `tar --usage' for more information. sh-3.2$ Maybe that option is deprecated? |
This option is a GNU extension to tar.
|
I guess that means my computer doesn't support it? Then, how do I get that command to work on my machine? Is there a similar command that is not part of the GNU extension?
|
I looked at the tar manual and info pages and the only way, as far as I see, is:
Code:
mkdir subfolder |
Alright. Thanks for all the help!
|
All times are GMT -5. The time now is 03:06 AM. |