Rsync フィルタ (含む/除外)

Rsync フィルタ (含む/除外)

一部のファイル/フォルダをrSyncしたいが、フィルタに問題があります。私のソースFSは次のとおりです。

.
|_ Invent/
|  |+ Comps/
|  |+ Prod/
|  |_ Other/
|_ Archive/
|  |_ Comps/
|  |_ Prod/
|  |_ Other/
|+ Comps.csv

ご存知のように、2つのディレクトリと1つのファイルを同期させたいと思います。また、ディレクトリとファイル構造を保存したいと思います。

./Invent/Comps/*
./Invent/Prod/*
./Comps.csv

次のコマンドを試しました。

rsync -avze "ssh -i key_file" 
    --include "Comps.csv" 
    --include "/Invent/Comp/*" 
    --include "/Invent/Prod/*" 
    --exclude "*" 
    /source/path/ rsync@srv:/target/path/

その結果、/source/path/でも多くのジャンクファイルが得られました。何が問題なの?

ベストアンサー1

少しブレーンストーミングの終わりに正しい解決策を見つけました。

--exclude 'Archive' 
--include 'Invent/Comp/' 
--include 'Invent/Prod/' 
--exclude 'Invent/*'

おすすめ記事