1 |
On Tue, 16 Nov 2010 23:01:51 +0000 Mick <michaelkintzios@×××××.com> |
2 |
wrote: |
3 |
> On Tuesday 16 November 2010 22:26:28 Stefan G. Weichinger wrote: |
4 |
> > Am 2010-11-16 22:24, schrieb Alan McKinnon: |
5 |
> > > Apparently, though unproven, at 23:12 on Tuesday 16 November |
6 |
> > > 2010, Mick did |
7 |
> > > |
8 |
> > > opine thusly: |
9 |
> > >> Excellent, it worked! :-) |
10 |
> > > |
11 |
> > > Glad to hear it. |
12 |
> > > |
13 |
> > > I could help because part of my job is running a rather big |
14 |
> > > public ftp mirror that management graciously pay for. And I went |
15 |
> > > down this rsync road a long time ago myself. |
16 |
> > > |
17 |
> > > You have no idea how many brain cells died in agony to figure out |
18 |
> > > this specific piece of rsync behaviour :-) |
19 |
> > |
20 |
> > ;-) |
21 |
> > |
22 |
> > I would like to know if my suggestion also works ;-) |
23 |
> > |
24 |
> > Yeah, include/exclude-patterns are rather hard to figure out |
25 |
> > sometimes ... nearly like regexes -> write once, read never .... |
26 |
> |
27 |
> Ha, ha! True! |
28 |
> |
29 |
> Stefan, I tried escaping the spaces (even tried \\ double and \\\ |
30 |
> triple escapes in case it makes a difference because of using ssh) |
31 |
> but still did not work. In my head I couldn't see how the full path |
32 |
> would not work, but the relative path would, but I tried it out all |
33 |
> the same. |
34 |
> |
35 |
> I still don't understand why Alan's recommendation works ;-) |
36 |
|
37 |
I'm probably late with my reply, but I'll post it so it will be in the |
38 |
archives for future reference. |
39 |
|
40 |
The man page is actually pretty clear on this issue. Quote: |
41 |
|
42 |
if the pattern starts with a / then it is anchored to a particular |
43 |
spot in the hierarchy of files, otherwise it is matched against the |
44 |
end of the pathname. This is similar to a leading ^ in regular |
45 |
expressions. Thus "/foo" would match a name of "foo" at either the |
46 |
"root of the transfer" (for a global rule) or in the merge-file’s |
47 |
directory (for a per-directory rule). An unqualified "foo" would |
48 |
match a name of "foo" anywhere in the tree because the algorithm is |
49 |
applied recursively from the top down; it behaves as if each path |
50 |
component gets a turn at being the end of the filename. Even the |
51 |
unanchored "sub/foo" would match at any point in the hierarchy |
52 |
where a "foo" was found within a directory named "sub". |
53 |
|
54 |
"Root of the transfer" is the directory you want to sync. Thus, if you |
55 |
run e.g. "rsync /var/log/ /mnt/backups/ --exclude=/portage/" then root |
56 |
of the transfer is /var/log, and therefore the directory |
57 |
/var/log/portage will be excluded. If on the other hand you write |
58 |
--exclude=portage/ then a directory named portage anywhere in the tree |
59 |
under /var/log will be excluded. Without the trailing slash, i.e. just |
60 |
--exclude=portage any file (regular file, directory, link, whatever) |
61 |
named portage anywhere in the tree gets excluded. And finally |
62 |
--exclude=/portage would exclude a file only at the top of the tree that |
63 |
is going to be synchronsed. |
64 |
|
65 |
Hope it helps. |
66 |
|
67 |
Cheers, |
68 |
Renat |
69 |
|
70 |
|
71 |
-- |
72 |
Probleme kann man niemals mit derselben Denkweise loesen, |
73 |
durch die sie entstanden sind. |
74 |
(Einstein) |