Mailing List Archive

Support open source code!

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

Re: tar and directory information

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 Yamashita                     
"Unix is a power tool. Power tools kill. Be careful."
                             -- a Computer Science professor at my college

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links