Gentoo Archives: gentoo-user

From: Kfir Lavi <lavi.kfir@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: rsync include exclude of regex conundrum
Date: Sun, 27 Mar 2011 13:07:06
Message-Id: AANLkTin950z-orT0VVYepe_aVhh4ifYr2n4U0scD=9J4@mail.gmail.com
In Reply to: [gentoo-user] Re: rsync include exclude of regex conundrum by Kfir Lavi
1 On Sun, Mar 27, 2011 at 2:14 PM, Kfir Lavi <lavi.kfir@×××××.com> wrote:
2 > On Thu, Mar 24, 2011 at 3:24 PM, Kfir Lavi <lavi.kfir@×××××.com> wrote:
3 >> Hi,
4 >> I want to rsync all the directories and files that contain the date
5 >> "2011.03.03".
6 >> Everything else should not be copied.
7 >> I did a lot of experiments and read web pages, but can't solve this
8 >> conundrum.
9 >>
10 >> kfir@goofy /tmp/rsync.test $ find
11 >> .
12 >> ./b
13 >> ./a
14 >> ./a/aaa
15 >> ./a/aaa/2011.03.03
16 >> ./a/2011.03.04
17 >> ./a/2011.03.03
18 >> kfir@goofy /tmp/rsync.test $ rsync -avvn --include "*" --include
19 >> "**2011.03.03**" --exclude "*" a/ b/
20 >> sending incremental file list
21 >> [sender] showing directory aaa because of pattern *
22 >> [sender] showing directory 2011.03.04 because of pattern *
23 >> [sender] showing directory 2011.03.03 because of pattern *
24 >> [sender] showing file aaa/2011.03.03 because of pattern *
25 >> delta-transmission disabled for local transfer or --whole-file
26 >> ./
27 >> 2011.03.03/
28 >> 2011.03.04/
29 >> aaa/
30 >> aaa/2011.03.03
31 >> total: matches=0  hash_hits=0  false_alarms=0 data=0
32 >>
33 >> sent 135 bytes  received 30 bytes  330.00 bytes/sec
34 >> total size is 0  speedup is 0.00 (DRY RUN)
35 >>
36 >> kfir@goofy /tmp/rsync.test $ rsync -av  --include "2011.03.03"  a b -v
37 >> sending incremental file list
38 >> [sender] showing directory a/2011.03.03 because of pattern 2011.03.03
39 >> [sender] showing file a/aaa/2011.03.03 because of pattern 2011.03.03
40 >> delta-transmission disabled for local transfer or --whole-file
41 >> a/
42 >> a/2011.03.03/
43 >> a/2011.03.04/
44 >> a/aaa/
45 >> a/aaa/2011.03.03
46 >>            0 100%    0.00kB/s    0:00:00 (xfer#1, to-check=0/5)
47 >> total: matches=0  hash_hits=0  false_alarms=0 data=0
48 >>
49 >> sent 179 bytes  received 47 bytes  452.00 bytes/sec
50 >> total size is 0  speedup is 0.00
51 >>
52 >> kfir@goofy /tmp/rsync.test $ rsync -avvn --include "*" --include
53 >> "**2011.03.03**" --exclude "*" a b
54 >> sending incremental file list
55 >> [sender] showing directory a because of pattern *
56 >> [sender] showing directory a/aaa because of pattern *
57 >> [sender] showing directory a/2011.03.04 because of pattern *
58 >> [sender] showing directory a/2011.03.03 because of pattern *
59 >> [sender] showing file a/aaa/2011.03.03 because of pattern *
60 >> delta-transmission disabled for local transfer or --whole-file
61 >> a/aaa/2011.03.03 is uptodate
62 >> total: matches=0  hash_hits=0  false_alarms=0 data=0
63 >>
64 >> sent 143 bytes  received 31 bytes  348.00 bytes/sec
65 >> total size is 0  speedup is 0.00 (DRY RUN)
66 >>
67 >> kfir@goofy /tmp/rsync.test $ rsync -avvn --include "*/" --include
68 >> "**2011.03.03**" --exclude "*" a b
69 >> sending incremental file list
70 >> [sender] showing directory a because of pattern */
71 >> [sender] showing directory a/aaa because of pattern */
72 >> [sender] showing directory a/2011.03.04 because of pattern */
73 >> [sender] showing directory a/2011.03.03 because of pattern */
74 >> [sender] showing file a/aaa/2011.03.03 because of pattern **2011.03.03**
75 >> delta-transmission disabled for local transfer or --whole-file
76 >> a/aaa/2011.03.03 is uptodate
77 >> total: matches=0  hash_hits=0  false_alarms=0 data=0
78 >>
79 >> sent 143 bytes  received 31 bytes  348.00 bytes/sec
80 >> total size is 0  speedup is 0.00 (DRY RUN)
81 >>
82 >>
83 >> Hope it is solvable.
84 >> Regards,
85 >> Kfir
86 >>
87 >
88 > Bump,
89 >
90 > No body uses rsync?
91 >
92 > Kfir
93 >
94
95 Ok,
96 I managed to do it like this:
97 cd a/
98 rsync -avnR $(find -ipath '*2011.03.03*') b/
99
100 Regards,
101 Kfir