beginning_of_the_world() {
files="
hrpc/oreno/katsu/chikin/recipe.txt
hrpc/oreno/katsu/pork/recipe.txt
hrpc/oreno/soup/recipe.txt
hrpc/oreno/dry/recipe.txt
hrpc/oreno/hayashi/recipe.txt
"
rm -fr hrpc mnpc
for fp in $files; do
fpd=${fp%/*}
mkdir -p $fpd
touch $fp
done
}
end_of_the_world() {
tree -F mnpc
rm -fr hrpc mnpc
}
rsync_filter_copy_subdir() {
cat <<EOF
+ oreno/katsu/
+ oreno/katsu/*
- oreno/*
EOF
}
beginning_of_the_world
rsync_filter_copy_subdir | rsync -av -O --filter='. -' hrpc/ mnpc/
end_of_the_world
rsync_filter_copy_dir_only() {
cat <<EOF
P oreno/**/
+ oreno/**/
- oreno/**/**
- oreno/*
EOF
}
beginning_of_the_world
rsync_filter_copy_dir_only | rsync -av -O --filter='. -' hrpc/ mnpc/
end_of_the_world
exit
rsync 2.6.9 にて。
rsync 3 系は、昔に試して2.6系と挙動が変わってのが原因でしくじったのがトラウマで使ってません。
$ ~/curry-daisuki.sh
building file list ... done
created directory mnpc
./
oreno/
oreno/katsu/
oreno/katsu/chikin/
oreno/katsu/chikin/recipe.txt
oreno/katsu/pork/
oreno/katsu/pork/recipe.txt
sent 291 bytes received 94 bytes 770.00 bytes/sec
total size is 0 speedup is 0.00
mnpc
`-- oreno/
`-- katsu/
|-- chikin/
| `-- recipe.txt
`-- pork/
`-- recipe.txt
4 directories, 2 files
building file list ... done
created directory mnpc
./
oreno/
oreno/dry/
oreno/hayashi/
oreno/katsu/
oreno/katsu/chikin/
oreno/katsu/pork/
oreno/soup/
sent 215 bytes received 68 bytes 566.00 bytes/sec
total size is 0 speedup is 0.00
mnpc
`-- oreno/
|-- dry/
|-- hayashi/
|-- katsu/
| |-- chikin/
| `-- pork/
`-- soup/
7 directories, 0 files