rsync与filter

我想将源代码文件从远程文件系统复制到本地服务器。 源代码文件扩展名是*。?pp,*。[CHh]。

我如何运行rsync来复制远程文件系统层次结构和源代码文件,排除其他所有内容(二进制文件,库,对象,存储库文件…)?

PS:到目前为止,我使用这个可怕的线,必须有一个更容易的解决scheme:

$ rsync --include "*/" --include="*/*" --include="*/*/*" --include="*/*/*/*" --include="*.[CHh]" --include="*.?pp" --exclude="*" -axW user@remote/my/remote/dir ./ 

您可以使用双星来简化包括:

  rsync -axw --exclude =“*”--include =“** /。[CHh]”--include“** / *。?pp”...