プロジェクト内のyamlファイルをdistフォルダーにコピーして、構造を維持しようとしています。ただし、node_modules
をコピーしています 欲しくない。 rsyncで除外するにはどうすればよいですか?また、以下のコマンドが機能しないのはなぜですか?
rsync -R --exclude=node_modules ./**/**.yaml dist
バリエーションなどを試したことに注意してください:
rsync -R --exclude= node_modules ./**/**.yaml dist
rsync -R --exclude 'node_modules' ./**/**.yaml dist
私のフォルダ構造:
projectroot
|--config/file.yaml
|
|--node_modules/somedir/somefile.yaml
|
|--src/somefolder/somefile.yaml
そして、私は上記を私の距離に次のように表示したいと思います:
dist
|--config/file.yaml
|
|--src/somefolder/somefile.yaml
承認された回答:
結局:
rsync -avrmR --exclude='node_modules/' --include='*/' --include='*.yaml' --exclude='*' ./ ./dist
仕組みは、最初にnode_modulesフォルダー内のすべてを除外し、次にすべてのディレクトリを含め、次にyamlファイルのみを含め、次に他のすべてを除外することです。