From owner-freebsd-questions@FreeBSD.ORG Wed Sep 3 07:13:03 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 4769116A4BF for ; Wed, 3 Sep 2003 07:13:03 -0700 (PDT) Received: from clunix.cl.msu.edu (clunix.cl.msu.edu [35.9.2.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id E1B3043FEC for ; Wed, 3 Sep 2003 07:12:56 -0700 (PDT) (envelope-from jerrymc@clunix.cl.msu.edu) Received: from clunix.cl.msu.edu (localhost [127.0.0.1]) by clunix.cl.msu.edu (8.12.9/8.12.9) with ESMTP id h83ECnOg004952; Wed, 3 Sep 2003 10:12:49 -0400 (EDT) Received: (from jerrymc@localhost) by clunix.cl.msu.edu (8.12.9/8.12.9/Submit) id h83ECnmN004951; Wed, 3 Sep 2003 10:12:49 -0400 (EDT) From: Jerry McAllister Message-Id: <200309031412.h83ECnmN004951@clunix.cl.msu.edu> To: chowse@charter.net (Charles Howse) Date: Wed, 3 Sep 2003 10:12:48 -0400 (EDT) In-Reply-To: <003101c3720d$a43d54d0$04fea8c0@moe> from "Charles Howse" at Sep 03, 2003 06:22:20 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 14:13:03 -0000 > > 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. Just cd in to the lowest level of directory structure you want to preserve and do the tar from there. So your example above would morph to: # cd # ls /disk2 # freebsd larry (directories) # cd /disk2 # tar cvfz ../larry.tgz * # # cp ../larry.tgz /disk3 (NOTE: using disk3 for clarity - to avoid the # cd /disk3 issue of replacing copies of the same file) # tar xvfz /larry.tgz # ls # freebsd larry (directories) larry.tgz There are possibly other ways using switches, but this makes most sense. ////jerry > > 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. > > > > Thanks, > Charles > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" >