我正在使用rsync
递归同步一个看起来像这样的远程文件夹树:
/folderA/a1/cache
/folderA/a1/cache/A1
/folderA/a1/cache/A2
/folderA/a1/somefolder
/folderA/a1/someotherfolder
/folderA/a2/somefolder/cache
/folderB/cache/
/folderB/b1/somefolder/cache
/folderB/b1/somefolder/yetanotherfolder/cache
/folderB/b1/somefolder/yetanotherfolder/cache/B1
/folderB/b1/somefolder/yetanotherfolder/cache/B2
Run Code Online (Sandbox Code Playgroud)
我不知道文件夹树会是什么样子,它会随着时间的推移而改变。所以我想要做的是递归rsync
上述但排除文件夹“缓存”和它包含的任何子文件夹:
/folderA/a1
/folderA/a1/somefolder
/folderA/a1/someotherfolder
/folderA/a2/somefolder
/folderB/
/folderB/b1/somefolder
/folderB/b1/somefolder/yetanotherfolder/
Run Code Online (Sandbox Code Playgroud)
有什么建议?
Jan*_*der 78
你想要--exclude
国旗。例如,本地 rsync:
rsync -a --exclude cache/ src_folder/ target_folder/
Run Code Online (Sandbox Code Playgroud)
这真的很简单——排除规则将匹配树中任何位置名为“缓存”的目录。
有关更多信息,请在 rsync 手册页上查找“--exclude”和“过滤规则”部分:
http://www.samba.org/ftp/rsync/rsync.html
归档时间: |
|
查看次数: |
59860 次 |
最近记录: |