Mailing List Archive

Support open source code!


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

Re: tar and directory information



Also better be carefull with symlinks when untarring.

I had /usr/local as a symlink to another mounted drive and untarring a tarfile
containing 'usr/local/bin/FILENAME' in '/' overwrote the link.

This left me with a very small and useless /usr/local until I realised the mistake
and moved things to the right places.



Shimpei Yamashita wrote:

> On Wed, Apr 11, 2001 at 09:12:24PM +0900, Darren Cook wrote:
> > > akamine> tar -zcvf data.tgz /home/work/data
> > > ...
> > > akamine> creates a directory /home/work/data in the current directory and puts
> > > akamine> the files in it. I want this not to happen (just to put the files and
> > > akamine> directories in the current directory). How can I do this?
> > >
> > > use -C or --directory option
> >
> > Or:
> >   cd /home/work/data
> >   tar -zcvf data.tgz *
>
> Well, you just missed all the files in that directories that start with a dot.
> To prevent that, you need to use . instead of *. You're also writing the
> archive into the very directory that you're backing up, which may not be a
> good idea. (You'd better hope, at any rate, that /home/work/data doesn't
> contain any file named data.tgz, because you just blew it away!) To prevent
> that, you need to use the GNU tar -C flag, or the shell redirection someone
> posted earlier.
>
> Shimpei.
>
> --
> Shimpei Yamashita                               http://www.shimpei.org/
> "Unix is a power tool. Power tools kill. Be careful."
>                              -- a Computer Science professor at my college
>
> -----------------------------------------------------------------------
> Next Nomikai Meeting:    Fri, April 13 19:30- Tengu Tokyo Eki Mae
> Next Technical Meeting:  Sat, May 12 13:30-
> -----------------------------------------------------------------------
> more info: http://www.tlug.gr.jp           Sponsor: Global Online Japan

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links