Exclude directory from --delete

J. Ellis jellis at dhnet.us
Sat Oct 3 22:03:24 MDT 2009

Hi, Matt--

Wow. This looks great.

So let me see if I understand correctly. First, are the \ characters
followed by a return, or are they all on a single line? In other words, is
this entered in the terminal as one command, or does it need to be broken up

And then each of the symlinks for the directories specified will be treated
as symlinks, but any symlinks below them will still be treated as symlinks?

Thanks again.


on 10/3/09 7:21 PM, Matt McCutchen at matt at mattmccutchen.net wrote:

> On Sat, 2009-10-03 at 15:47 -0700, J. Ellis wrote:
>> I have the following 3 commands which are supposed to run every night
>> to back up my web server:
>> rsync -avve ssh --numeric-ids --delete --ignore-errors
>> myuser at myisp.com:/usr/home/myuser /Volumes/Downloads
>> rsync -avve ssh --copy-links --numeric-ids --delete --ignore-errors
>> myuser at myisp.com:/usr/home/myuser/mail_boxes
>> /Volumes/Downloads/myuser/mail_boxesBU
>> rsync -avve ssh --copy-links --numeric-ids --delete --ignore-errors
>> myuser at myisp.com:/usr/home/myuser/mail_boxes
>> /Volumes/Downloads/myuser/mail_boxesBU
>> The way this works is that there are two symlinks on the server to the
>> mail_boxes and public_html directories. I didn¹t want all the symlinks
>> within those directories to be followed, so these I backup separately
>> to mail_boxesBU and public_htmlBU respectively.
> There happens to be a trick for "copying a few dirlinks" without copying
> all of them: use --relative and specify an additional source argument
> that goes through each symlink with a trailing slash.  E.g.:
> rsync -avve ssh --numeric-ids --delete --ignore-errors -R \
> myuser at isp.com:/usr/home/./myuser \
> myuser at isp.com:/usr/home/./myuser/mail_boxes/ \
> myuser at isp.com:/usr/home/./myuser/public_html/ \
> /Volumes/Downloads
> For more about this, see:
> http://lists.samba.org/archive/rsync/2006-February/014838.html
>> Unfortunately, when the first command is run, both are deleted from
>> the local volume, and then must be completely downloaded from scratch
>> each night after the deletion, instead of simply being updated. This
>> doesn¹t always work for some reason, and the next morning one or both
>> of the directories are just gone.
>> Is there some way of excluding the mail_boxesBU and public_htmlBU
>> directories from --delete?
> If you want to keep your existing approach, yes, you can just use
> --exclude='/myuser/mail_boxesBU' and --exclude='/myuser/public_htmlBU'.

More information about the rsync mailing list