On Tue, Jan 23, 2007 at 01:55:08PM +0100, Tomas M wrote:
| I'd like to create a tar archive from few directories and combine them
| to a single directory in Tar. This is a task for Tar guru I guess,
Nah!
| as I
| am unable to find the solution in documentation.
|
| For example, I'd like to pack
| /usr/local/modules/*
| /var/modules/*
| to a single Tar archive, which will only contain (this is my problem)
| the files (and directories) from the dirs mentioned above
| combined into root, but without the leading path.
|
| I tried
| tar --create --file output.tar /var/modules/* /usr/local/modules/*
Try this :
tar --create --file=output.tar -C /var/modules . -C /usr/local/modules .
-C, --directory DIR
change to directory DIR
The only real gotcha here is that you can't use `*' as the * is
expanded by your shell, and your shell won't know that it should be
looking in another directory after the -C/--directory options. So
instead of using `*', use `.'
Another option (probably not as good, however), would be this --
--strip-components NUMBER, --strip-path NUMBER
strip NUMBER of leading components from file names before
extraction
(1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-compo-
nents
but it appears to be used at extraction time, not creation time -- so
it could extract the tar file the way you want it, but the tar file
itself wouldn't be the way you want it.
--
Doug McLaren, [EMAIL PROTECTED]
There is always one item on the screen menu that is mislabeled and should
read "ABANDON HOPE ALL YE WHO ENTER HERE".