From owner-freebsd-questions Tue Oct 1 11: 3:58 2002 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 2830337B401 for ; Tue, 1 Oct 2002 11:03:57 -0700 (PDT) Received: from maile.telia.com (maile.telia.com [194.22.190.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D13743E4A for ; Tue, 1 Oct 2002 11:03:55 -0700 (PDT) (envelope-from erikt@midgard.homeip.net) Received: from falcon.midgard.homeip.net (h63n1fls20o913.telia.com [212.181.162.63]) by maile.telia.com (8.12.5/8.12.5) with SMTP id g91I3rpo025770 for ; Tue, 1 Oct 2002 20:03:53 +0200 (CEST) X-Original-Recipient: Received: (qmail 39336 invoked by uid 1001); 1 Oct 2002 18:03:46 -0000 Date: Tue, 1 Oct 2002 20:03:46 +0200 From: Erik Trulsson To: Dan Nelson Cc: Beech Rintoul , freebsd-questions@FreeBSD.ORG Subject: Re: Copying directories contents Message-ID: <20021001180346.GA39309@falcon.midgard.homeip.net> Mail-Followup-To: Dan Nelson , Beech Rintoul , freebsd-questions@FreeBSD.ORG References: <200210010955.35018.akbeech@anchoragerescue.org> <20021001175837.GF7147@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021001175837.GF7147@dan.emsphone.com> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Oct 01, 2002 at 12:58:38PM -0500, Dan Nelson wrote: > In the last episode (Oct 01), Beech Rintoul said: > > I'm need to take the contents including dotfiles from about 300 user > > directories and move them into another set of identical directories on > > another filesystem. Is there an easy script to do this? I dont want to > > overwrite the contents of the target directories just add to them. > > Both filesystems are mounted on the source machine. > > tar cf - user1 user2 user3 user4 | ( cd /destination ; tar xpf - ) To avoid starting an extra shell process you can also do: tar cf - user1 user2 user3 user4 | tar xpf - -C /destination > > Change "tar xpf" to "tar xpkf" if you don't want to overwrite exisitng > files in the destination directory. > > "cp -r" might work also; I have never tried it when the destination was > aready populated with files, though. "cp -r" won't work well with symlinks. ("cp" will copy the file the symlink points to, while tar will make a new symlink in the destination directory.) -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message