From owner-freebsd-questions@FreeBSD.ORG Mon Nov 10 15:19:32 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 637D4106567D for ; Mon, 10 Nov 2008 15:19:32 +0000 (UTC) (envelope-from dkelly@Grumpy.DynDNS.org) Received: from smtp.knology.net (smtp.knology.net [24.214.63.101]) by mx1.freebsd.org (Postfix) with ESMTP id EC2838FC1F for ; Mon, 10 Nov 2008 15:19:31 +0000 (UTC) (envelope-from dkelly@Grumpy.DynDNS.org) Received: (qmail 18732 invoked by uid 0); 10 Nov 2008 15:19:30 -0000 Received: from unknown (HELO Grumpy.DynDNS.org) (75.76.211.79) by smtp8.knology.net with SMTP; 10 Nov 2008 15:19:30 -0000 Received: by Grumpy.DynDNS.org (Postfix, from userid 928) id 6933528429; Mon, 10 Nov 2008 09:19:30 -0600 (CST) Date: Mon, 10 Nov 2008 09:19:30 -0600 From: David Kelly To: chloe K Message-ID: <20081110151930.GB73102@Grumpy.DynDNS.org> References: <257066.24717.qm@web57412.mail.re1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <257066.24717.qm@web57412.mail.re1.yahoo.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-questions@freebsd.org Subject: Re: hundred files to tar and untar X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: FreeBSD-Questions@FreeBSD.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Nov 2008 15:19:32 -0000 On Mon, Nov 10, 2008 at 08:10:36AM -0500, chloe K wrote: > Hi > > I have hundred files to tar > > How can I make tar the file but untar in different folder? > > eg: > > tar cvf html.tar /var/web/data/verion/cc.html > > untar html.tar /var/web/data/root/cc.html > > Thank you RTFM. Specifically look at the -C option. Or you could do it the simple way (note parenthesis, the cd only applies within the parenthesis, when the command clompletes your shell is back to the original directory): (cd /var/web/data/verion/cc.html ; tar -cvf /html.tar * ) (cd /var/web/data/root/cc.html ; tar -xvf /html.tar ) The above does not store the path prefix in the tar archive, which is perhaps the problem you were trying to solve? -- David Kelly N4HHE, dkelly@HiWAAY.net ======================================================================== Whom computers would destroy, they must first drive mad.