3 # Copyright (C) 2004-2022 Wayne Davison
5 # This program is distributable under the terms of the GNU GPL (see
8 # Make sure we can merge files from multiple directories into one.
10 .
"$suitedir/rsync.fns"
12 # Build some files/dirs/links to copy
14 # Use local dirnames to better exercise the arg-parsing code.
17 mkdir from1 from2 from3 deep
18 mkdir from
2/sub1 from
3/sub1
19 mkdir from
3/sub2 from
1/dir-and-not-dir
20 mkdir chk chk
/sub1 chk
/sub2 chk
/dir-and-not-dir
22 cp_touch from
1/one from
2/one
23 cp_touch from
1/one from
3/one
25 echo "three" >from
2/three
26 echo "four" >from
3/four
27 echo "five" >from
1/five
29 echo "sub1" >from
2/sub
1/uno
30 cp_touch from
2/sub
1/uno from
3/sub
1/uno
31 echo "sub2" >from
3/sub
1/dos
32 echo "sub3" >from
2/sub
1/tres
33 echo "subby" >from
3/sub
2/subby
34 echo "extra" >from
1/dir-and-not-dir
/inside
35 echo "not-dir" >from
3/dir-and-not-dir
36 echo "arg-test" >deep
/arg-test
37 echo "shallow" >shallow
39 cp_touch from
1/one from
1/two from
2/three from
3/four from
1/five from
3/six chk
40 cp_touch deep
/arg-test shallow chk
41 cp_touch from
1/dir-and-not-dir
/inside chk
/dir-and-not-dir
42 cp_touch from
2/sub
1/uno from
3/sub
1/dos from
2/sub
1/tres chk
/sub1
43 cp_touch from
3/sub
2/subby chk
/sub2
45 # Make sure that time has moved on.
48 # Get rid of any directory-time differences
49 $RSYNC -av --existing -f 'exclude,! */' from
1/ from
2/
50 $RSYNC -av --existing -f 'exclude,! */' from
2/ from
3/
51 $RSYNC -av --existing -f 'exclude,! */' from
1/ chk
/
52 $RSYNC -av --existing -f 'exclude,! */' from
3/ chk
/
54 checkit
"$RSYNC -avv deep/arg-test shallow from1/ from2/ from3/ to/" "$chkdir" "$todir"
56 # The script would have aborted on error, so getting here means we've won.