[ILUG] tar...
Niall O Broin
niall at linux.ie
Sun Nov 18 15:56:10 GMT 2001
On Sun, Nov 18, 2001 at 06:32:24AM +0000, kevin lyda wrote:
> let's say i want to tar directory foo, but i want it to untar later as
> directory foo-1.0.0. how can i get tar to do that?
Is there a reason why any of the following won't do:
1) mv foo foo-1.0.0; tar cf file.tar foo-1.0.0; mv foo-1.0.0 foo
2) ln -d foo foo-1.0.0; tar cf file.tar foo-1.0.0;rmdir foo-1.0.0
3) cd foo; tar cf file.tar .
# extract step
mkdir foo-1.0.0; cd foo-1.0.0; tar xf file.tar
3) cd foo; tar cf file.tar .
# extract step
mkdir foo-1.0.0; cd foo-1.0.0; tar xf file.tar
and goodness knows how many other variations on the theme. However, I don't
believe that there's any way you can do
tar cf file.tar foo
and then have a subsequent
tar xf file.tar
create the directory foo-1.0.0 instead of foo.
You could probably achieve what you want with the --use-compress-program
switch and a custom program which would mangle a tar stream passed through
it but bugger me if I can see why you'd do that rather than one of the nice
simple solutions mentioned above.
Niall
More information about the ILUG
mailing list