Rsync and recursion protection with .svn folders

Richard Lee richard at
Wed Dec 17 17:02:18 GMT 2008

Dear rsync forum,

I'm writing to you regarding svn rsync problem.

Here is the premise. I am a web developer who needs to use svn.
Unfortunately I cannot install in on the production server. So what I have
done is that I copy the whole website folder from the server via ftp (I have
no other access) to my local machine using lftp.

At this stage I try to use sync the local copy folder with a svn working
copy folder. I cannot just use svn to commit the local copy folder because
it needs the .svn folders in each sub/folder of the svn working copy. At
first I tried to use unified diff, but that did not handle changes in the
directory structure. So then I tried using rsync, but the .svn folders
caused me problems.

To simplify things I am trying to rsync changes:

src(local copy) --> dst(svn working copy)

[I shall use src and dst from now on for ease.]

The way svn works is that it keeps a hidden .svn folder in each folder to
keep track of the changes made to the contents. These folders are in all the
folders in dst, but not in src.

I want to sync changes over from src to dst, leaving the .src folders intact
on the dst, as long as the folder containg the .src folder still exists in
the source. i.e. If a folder is deleted from src I would like it to be
deleted from dst, this implies that its .svn folder is deleted in dst.
(Additions and changes are handled automatically by svn.)

So what I did is a rsync fom src to dst with --exclude=".svn" --delete
--force. However if I delete a folder say myfol from source which also
exists in dst, I says that it cannot delete it. Obviously this is due to the
fact that rsync recurses and finds and protects the .svn in myfol.

I have tried using a combination of risk and protect, include and exclude to
try and delete the redundant folders, but with no avail. Is that any way to
to this via rsync filters, or do I have to use scripting?


View this message in context:
Sent from the Samba - rsync mailing list archive at

More information about the rsync mailing list