From owner-freebsd-ports Sat Aug 10 02:29:15 1996 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id CAA27057 for ports-outgoing; Sat, 10 Aug 1996 02:29:15 -0700 (PDT) Received: from relay.nuxi.com (nuxi.cs.ucdavis.edu [128.120.56.38]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id CAA27048 for ; Sat, 10 Aug 1996 02:29:13 -0700 (PDT) Received: (from obrien@localhost) by relay.nuxi.com (8.7.5/8.6.12) id CAA01408; Sat, 10 Aug 1996 02:29:01 -0700 (PDT) From: "David E. O'Brien" Message-Id: <199608100929.CAA01408@relay.nuxi.com> Subject: Re: using tar To: narvi@haldjas.folklore.ee (Narvi) Date: Sat, 10 Aug 1996 02:29:00 -0700 (PDT) Cc: freebsd-ports@freebsd.org (FreeBSD ports list) In-Reply-To: from Narvi at "Aug 10, 96 12:08:35 pm" X-PGP-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Keyid: 34F9F9D5 X-Mailer: ELM [version 2.4ME+ PL22 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-ports@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > > I want to use tar to move a directory hierarchy, but I want to do it > > > without using a temp directory, and I don't know the syntax to make tar > > > create an archive to stdout, then read from stdout to extract the acrchive > > > > tar -cf - -C $SRCDIR . | tar xpf - -C $DESTDIR > > > > Will do the trick. > > Why not just mv $SRCDIR $DESTDIR? Yes, if $DESTDIR exist you will have to > write a for $i in ...; do mv $i $DESTDIR; done? Many mv's can't move a directory structure across devices (read disk partitions) because of the limitations of rename(2). Thus you can only use mv if $SRCDIR and $DESTDIR are on the same partition. For instance, GNU's mv gives: mv: cannot move `foo' across filesystems: Not a regular file -- David (obrien@cs.ucdavis.edu)