Hi all, I am having *massive* problems trying to exclude a single directory from an rsync. I have serv1 and serv2. I am trying to rsync /foo/test from serv1 to /foo on serv2 I want to exclude the directory /foo/test/dir1 So I try: rsync -av --exclude-from=/foo/rsync.excludes /foo/test serv2:/foo rsync.excludes contains: /foo/test/dir1/ This is not working. I also try: rsync -av --exclude=/foo/test/dir1/ /foo/test serv2:/foo and the exclude still does not work. I have also tried other variations like: rsync -av --exclude=/dir1/ /foo/test serv2:/foo also to no avail. I have spent many hours reading the manpage and searching google. I see many examples on exluding but nothing on how to exclude one simple directory as I am trying to do. I am really glad you added the "EXCLUDE PATTERNS" section in the manpage, but it is still not very helpful. I think that something as basic as excluding one single directory should be straightforward and simple to execute and not require such extensive difficulty. I have used rsync for a few years now. My opinion is that it is a great tool but its potential usefulness is limited by some extreme quirkiness as to how paths get specified and its extensive switch options many of which should just be included by default. For example, maybe having a meta-switch such as --mirror which contains a set of popular switches used in most mirroring situations. In this regard, I think the --backup option is a bad idea and instead --backup should be a meta-switch that includes options useful for backups. Most people I think are usually trying to mirror or to backup. -- ____________________________________________ | Simulated Windows reboot | | | | CrossOver is simulating a Windows reboot. | | Please Wait... | -------------------------------------------- - message window that appears while installing MS Office under CrossOver Office
Hi, ...> rsync -av --exclude=/foo/test/dir1/ /foo/test serv2:/foo > and the exclude still does not work.The following works: rsync -av --exclude=/test/dir1/ /foo/test serv2:/foo Why? Because one should think the exclude pathnames are *relative* ones to the destination directory. In your case, you want the /foo/test directory to be copied as serv2:/foo/test. Note that this is equivalent to: rsync -av --exclude=/dir1/ /foo/test/ serv2:/foo/test I admit that this is not quite obvious. -- Francis.Montagnac@sophia.inria.fr, Tel: (33) 04 92 38 79 11, Bur: C112 INRIA Sophia, 2004, rte des Lucioles, B.P.93 - 06902 Sophia Antipolis Cedex
On Tue, 25 Nov 2003, daniel <djoneill@gmx.net> wrote:> Hi all, > > I am having *massive* problems trying to exclude a single directory from an rsync. > > I have serv1 and serv2. I am trying to rsync /foo/test from serv1 to > /foo on serv2 I want to exclude the directory /foo/test/dir1 So I try: > > rsync -av --exclude-from=/foo/rsync.excludes /foo/test serv2:/foo > > rsync.excludes contains: > /foo/test/dir1/ > > > This is not working.You are attempting to use an absolute path in the exclusion. You want a relative path. A leading "/" just anchors it to the base of the tree for filename comparison (instead of floating it). It looks like you figured that out later, though.> I also try: > > rsync -av --exclude=/foo/test/dir1/ /foo/test serv2:/foo > > and the exclude still does not work.Different syntax - same reason for failure.> I have also tried other variations like: > > rsync -av --exclude=/dir1/ /foo/test serv2:/foo > > also to no avail.This would have worked if you had specified the same paths for the source and the destination. You tried to take a shortcut by not including 'test' in the destination and not using a trailing slash in the source. So now, the source root is "/foo/" (without the "test"). Therefore, the exclusion is trying to match "/foo/dir1/". Either of these two commands should work - I recommend the 2nd: rsync -av --exclude=/test/dir1/ /foo/test serv2:/foo rsync -av --exclude=/dir1/ /foo/test/ serv2:/foo/test/ As a matter of habit and principle, I always specify the complete paths down to the trailing / when I rsync two directories. Then there's never any confusion about what's going to happen. -- John Van Essen Univ of MN Alumnus <vanes002@umn.edu>
> Hi all, > > I am having *massive* problems trying to exclude a single directory from an rsync. > > I have serv1 and serv2. I am trying to rsync /foo/test from serv1 to /foo on serv2 I want to exclude the directory /foo/test/dir1 So I try: > > rsync -av --exclude-from=/foo/rsync.excludes /foo/test serv2:/foo > > rsync.excludes contains: > /foo/test/dir1/ > > > This is not working. > > I also try: > > rsync -av --exclude=/foo/test/dir1/ /foo/test serv2:/foo > > and the exclude still does not work. > > I have also tried other variations like: > > rsync -av --exclude=/dir1/ /foo/test serv2:/foo > > also to no avail. >rsync -av --exclude=/test/dir1/ /foo/test/ serv2:/foo/ rsync -av --exclude=/dir1/ /foo/test/ serv2:/foo/test/ Thank you for clarifying the issue with regard to the fact that the exclude pattern is relative to the destination path. The fact that: rsync -av --exclude=/foo/test/dir1/ /foo/test/ serv2:/foo/ does not work seems wrong. What should be excluded is being specified with no ambiguity.