Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Oct 2002 14:04:23 -0400 (EDT)
From:      Peter Leftwich <Hostmaster@Video2Video.Com>
To:        FreeBSD LIST <FreeBSD-Questions@FreeBSD.Org>
Subject:   Re: Copying directories contents
Message-ID:  <20021001140103.G2271-100000@earl-grey.cloud9.net>
In-Reply-To: <20021001175837.GF7147@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 1 Oct 2002, 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 - )

I really must learn how to use conditional stuff in Unix, such as && and
parentheses :)

> 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.
> 	Dan Nelson
> 	dnelson@allantgroup.com

I have often run into a similar situation.  There doesn't seem to be a
command line or GUI file explorer you can use to "stitch together" source
directories and subdirectories into the target directory.  For example, if
you have differing files but in the same exact folder tree structure, is
there a command to weave (mv) the files in?  This would be a scheme that
favors only files and that runs a "test" of basically saying "is the
directory there already? yes, then mv this file into it, no, then create it
and move this file into it..." but on a wider scale.

--
Peter Leftwich
President & Founder
Video2Video Services
Box 13692, La Jolla, CA, 92039 USA
+1-413-403-9555


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021001140103.G2271-100000>