Date: Tue, 1 Oct 2002 20:03:46 +0200 From: Erik Trulsson <ertr1013@student.uu.se> To: Dan Nelson <dnelson@allantgroup.com> Cc: Beech Rintoul <akbeech@anchoragerescue.org>, freebsd-questions@FreeBSD.ORG Subject: Re: Copying directories contents Message-ID: <20021001180346.GA39309@falcon.midgard.homeip.net> In-Reply-To: <20021001175837.GF7147@dan.emsphone.com> References: <200210010955.35018.akbeech@anchoragerescue.org> <20021001175837.GF7147@dan.emsphone.com>
index | next in thread | previous in thread | raw e-mail
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.)
--
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021001180346.GA39309>
