cp(1) -n option for rsync?

tim.conway at philips.com tim.conway at philips.com
Fri Dec 6 21:17:00 EST 2002

You could find on the source (exclude directories), and use that output 
for --exclude-from=.
That would be the one case where include/exclude patterns would be easy - 
no unexpected matches or misses.
Yeah, I like that one best.

to sync remotehost:/path/to/dir to /dir
cd /dir
find . \! -type d -print >/tmp/excludefordirfile
rsync -a --exclude-from=/tmp/excludefordirfile remotehost:/path/to/dir/. .
rm /tmp/excludefordirfile
If the dir is small, you could probably even just
cd /dir
rsync -a --exclude="`find . \! -type d -print`" remotehost:/path/to/dir/. 
, but i'm never quite certain what a shell is going to do with my 
backslashes and quotes, without testing it on the system running the code, 
and the proc using the interim file is less likely to choke on commandline 

Tim Conway 
conway.tim at spilihp.com reorder name and reverse domain 
303.682.4917 office, 303.921.0301 cell 
Philips Semiconductor - Longmont TC 
1880 Industrial Circle, Suite D 
Longmont, CO 80501 
Available via SameTime Connect within Philips, caesupport2 on AIM 
"There are some who call me.... Tim?" 

Sander van Zoest <sander at yahoo-inc.com>
Sent by: rsync-admin at lists.samba.org
12/06/02 12:53 PM

        To:     rsync at lists.samba.org
        cc:     (bcc: Tim Conway/LMT/SC/PHILIPS)
        Subject:        cp(1) -n option for rsync?


I looked in the archives and documentation and didn't notice anything
of this. The closest thing I found was -update, but that doesn't do
exactly to what I would like.

I would like to be able to use rsync to mirror some directories, but
to explicitly *not* override any files that already exist on the other
side. Sort of like a file system "append", if you will.

The cp(1) command on FreeBSD has the option -n:
    -n    Do not overwrite an existing file.  (The -n option overrides any
           previous -f or -i options.)

I was wondering if I could somehow accomplish this doing an rsync between
two machines?

I'd like to avoid to have to do an test -e over ssh to see the file exists
before copying the file accross.

Any info would be appreciated.


Sander van Zoest                                          +1 (619) 
Yahoo!, Inc. sander at yahoo-inc.com
<http://www.yahoo.com/>                       <http://sander.vanzoest.com/>
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html

More information about the rsync mailing list