bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tar question: adding to "fake" subdirectory


From: Eli Zaretskii
Subject: Re: tar question: adding to "fake" subdirectory
Date: Thu, 5 Jul 2001 09:42:21 +0300 (IDT)

On Wed, 4 Jul 2001, Matthew Cornell wrote:

> I'm using tar (GNU tar) 1.13.17. I'm relatively new to tar and I have
> a question: I'm trying to get tar to add a file under a "fake"
> subdirectory in the new archive

I think you can't.  Tar cannot put into the archive directories which
don't exist because it needs to record information about those
directories.

> I tried something this, but it didn't work:
> 
>     tar czf test.tgz -C s1 s2/t.txt
> 
> but it said: "tar: s2/t.txt: Cannot stat: No such file or
> directory".

You misunderstood the intent of the manual.  What it explains in the
fragment you cited is that if you have

   ./s1
   ./s1/s2
   ./s1/s2/t.txt

then the command "tar czf test.tgz -C s1 s2/t.txt" will record
"s2/t.txt" in the archive instead of "s1/s2/t.txt".  That way, when
this archive is unpacked, "s2/t.txt" will be extracted into the
current directory instead of under s1.

But this still requires that the directories be present in your
filesystem.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]