the protect flag - P doesn't work with --relative option ?

paresh masani masaniparesh at gmail.com
Tue Aug 4 00:13:54 MDT 2009


Sorry, I think I wasn't much clear. Here is the exact issue:

destHost#> ls  /tmp/mydir/2008
file      mydir3    new       preserve

The below command deletes the "/tmp/mydir/2008/mydir3" directory.

sourceHost#/tmp/mydir> rsync -avz --relative --delete --include='+ /2008/.'
--filter='H /2008/mydir3' --exclude='- /2008/preserve' 2008/.
destHost:/tmp/mydir
sending incremental file list
2008/
deleting 2008/mydir3/

sent 138 bytes  received 17 bytes  34.44 bytes/sec
total size is 0  speedup is 0.00

The below command doesn't delete the "/tmp/mydir/2008/mydir3" directory but
deletes "/tmp/mydir/2008/new/mydir3". Is there any way to tell rsync to
delete "/tmp/mydir/2008/mydir3" directory from below command?

sourceHost#/tmp/mydir/2008> rsync -avz --relative --delete --include='+
/new/.' --filter='H /mydir3' new/. destHost:/tmp/mydir/2008
sending incremental file list

sent 73 bytes  received 13 bytes  9.05 bytes/sec
total size is 0  speedup is 0.00

sourceHost#/tmp/mydir/2008> rsync -avz --relative --delete --include='+
/new/.' --filter='H /mydir3' new/. destHost:/tmp/mydir/2008
sending incremental file list
new/
deleting new/mydir3/

sent 76 bytes  received 16 bytes  16.73 bytes/sec
total size is 0  speedup is 0.00

Thanks, Paresh

On Tue, Aug 4, 2009 at 12:55 AM, paresh masani <masaniparesh at gmail.com>wrote:

> Hi,
>
> Basically, I want to preserve some of directories on destination side
> conditionally and hence, I choose to use --filter option mentioned in rsync
> man pages. I noticed that --filter option works as expected when I don't
> have --relative option used but in below case it doesn't work.
>
> rsync  -avz  --relative --delete  --filter='H /mydir2' --exclude='-
> /preserve'  mydir1/. destHost:/tmp/mydir
>
> I want to sync "/tmp/mydir/mydir1", delete "mydir2" and protect and hide
> "preserve" directory on destination host.
>
> I noticed that rsync doesn't deletes the "mydir2" on destination host but
> if I remove --relative then it does. Could anyone tell me is there any
> dependencies between Hide and Protect flag with --relative option? How to
> make rsync to delete directories with H flag set and --relative option
> specified?
>
> Thanks.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20090804/67d80e10/attachment.html>


More information about the rsync mailing list