You are not logged in.

#1 2010-08-10 09:33:37

lang2
Member
Registered: 2006-02-10
Posts: 386

rsync remove files unexpectedly

Hello all,

I have another problem with rsync. So here is what I'm trying to do: I have tree B, which is under svn. I then have tree A which I want to sync to B so that when I'm done A and B will be identical, except for the .svn directories as A is not under svn. The tree is over 2G in size.

Here is my command:

rsync --progress -av --exclude=.svn --delete

It works most of the time but sometime, some files would be deleted from B but present in A.

Is there something wrong with my magical command?


tx

Offline

#2 2010-08-10 10:39:10

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: rsync remove files unexpectedly

Which (type of) files remain under A when this happens?


ᶘ ᵒᴥᵒᶅ

Offline

#3 2010-08-10 10:53:14

lang2
Member
Registered: 2006-02-10
Posts: 386

Re: rsync remove files unexpectedly

Now I understand a bit more. It's not (entirely) rsync's fault:

So in B there used to be a directory foo, under which there's a bunch of files. In tree A foo is changed to a symbolic link to someother directory in the tree. So when rsync tries to do its job, it cannot do it and said: rmdir "foo" failed: Directory not empty.

My script actually then tries to do 'svn rm foo' after rsync which result in the diff.

How do I handle this? Shouldn't rsync do 'rm -rf' instead of 'rmdir'?

Offline

#4 2010-08-10 11:30:14

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: rsync remove files unexpectedly

So if i understand correctly, you (manually) remove directory foo under A and replace it with a symlink to another directory, then rsync A to B again? What are you actually trying to accomplish, do you want to work/fork on a project that you get through svn?


ᶘ ᵒᴥᵒᶅ

Offline

#5 2010-08-10 11:40:18

lang2
Member
Registered: 2006-02-10
Posts: 386

Re: rsync remove files unexpectedly

hmmm. Basically I'm just trying to mirror tree A to tree B without touching the svn stuff. There is an non-empty directory under B that's a sym link on A side and that's causing me trouble. I thought rsync should be able to handle this situation since it's used for mirroring all the time.

Offline

#6 2010-08-10 11:56:49

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: rsync remove files unexpectedly

If you only want a working copy of B, then ideally you shouldn't touch anything in A. Why is that non-empty directory in B a symlink in A, instead of a full copy?


ᶘ ᵒᴥᵒᶅ

Offline

#7 2010-08-10 12:13:02

lang2
Member
Registered: 2006-02-10
Posts: 386

Re: rsync remove files unexpectedly

I'm not doing anything to A as it should just be a read only source. Basically I have a tree that's under svn but it out-of-date. Somebody send me an updated tree with changes in them and I'd like to merge them. One of the changes are that a non-empty directory is changed to a link.


Thanks,

Offline

#8 2010-08-10 14:12:44

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: rsync remove files unexpectedly

In this case, since it is a one-time process, i would just manually correct those errors. smile


ᶘ ᵒᴥᵒᶅ

Offline

#9 2010-08-10 15:30:08

Proofrific
Member
Registered: 2008-01-05
Posts: 215

Re: rsync remove files unexpectedly

lang2 wrote:

I'm not doing anything to A as it should just be a read only source. Basically I have a tree that's under svn but it out-of-date. Somebody send me an updated tree with changes in them and I'd like to merge them. One of the changes are that a non-empty directory is changed to a link.

Why not rename/move your current tree, then "svn checkout" the updated tree?

Offline

Board footer

Powered by FluxBB