From owner-freebsd-questions@FreeBSD.ORG Wed Sep 3 04:40:04 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE7A416A4BF for ; Wed, 3 Sep 2003 04:40:04 -0700 (PDT) Received: from gwdu60.gwdg.de (gwdu60.gwdg.de [134.76.8.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3D5F94400E for ; Wed, 3 Sep 2003 04:40:03 -0700 (PDT) (envelope-from kheuer2@gwdg.de) Received: from gwdu60.gwdg.de (localhost [127.0.0.1]) by gwdu60.gwdg.de (8.12.8p1/8.12.8) with ESMTP id h83Be1or047306; Wed, 3 Sep 2003 13:40:01 +0200 (CEST) (envelope-from kheuer2@gwdg.de) Received: from localhost (kheuer2@localhost)h83Be0An047300; Wed, 3 Sep 2003 13:40:00 +0200 (CEST) X-Authentication-Warning: gwdu60.gwdg.de: kheuer2 owned process doing -bs Date: Wed, 3 Sep 2003 13:40:00 +0200 (CEST) From: Konrad Heuer To: Charles Howse In-Reply-To: <003101c3720d$a43d54d0$04fea8c0@moe> Message-ID: <20030903133619.B41403-100000@gwdu60.gwdg.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-questions@freebsd.org Subject: Re: Tar question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Sep 2003 11:40:04 -0000 On Wed, 3 Sep 2003, Charles Howse wrote: > I'm a little confused about the arguments for tar. > I want to tar the contents of a directory and save that .tgz file for > backup purposes. > > Problem is, when I copy larry.tgz to /disk2 and: > Tar xvfz larry.tgz > It creates the /disk2 file structure within /disk2. > > # cd > # ls /disk2 > # freebsd larry (directories) > # tar cvfz larry.tgz /disk2 > # cp larry.tgz /disk2 > # cd /disk2 > # tar xvfz larry.tgz > # ls > # freebsd larry disk2 (directories) > > How can I make tar not create the directory structure within the same > directory? > Does that make sense? > I tried tar cvfzP, no joy. > > Man tar didn't have anything that jumped out at me, but I could have > missed or misunderstood something. > If the solution is in the man page, I would appreciate a reference to > the section, so I can re-read it to understand. My suggestion is: tar cvCfz /disk2 larry.tgz . tar will cd to /disk2 before interpreting the dot - thus the content of /disk2 will be archived, but without a leading "disk2" in the table of contents. Regards Konrad Heuer (kheuer2@gwdg.de) ____ ___ _______ GWDG / __/______ ___ / _ )/ __/ _ \ Am Fassberg / _// __/ -_) -_) _ |\ \/ // / 37077 Goettingen /_/ /_/ \__/\__/____/___/____/ Germany