Skip to content

Instantly share code, notes, and snippets.

@songlairui
Created December 4, 2019 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save songlairui/f40def00e2cdf381816a2d5897dc6ad3 to your computer and use it in GitHub Desktop.
Save songlairui/f40def00e2cdf381816a2d5897dc6ad3 to your computer and use it in GitHub Desktop.
测试 Rsync SRC 末尾带 / 的表现
#!/bin/sh
## [without test folder created] create ~/test/test Then put files
## [with test folder created] create ~/test/test Then put files
rsync -avz --exclude='node_modules/' --exclude='_static/' ./test ali:test
## [without] create ~/test Then put files
## [with] create ~/test Then put files
rsync -avz --exclude='node_modules/' --exclude='_static/' ./test/ ali:test
## [without] create ~/test/test Then put files
## [with] create ~/test/test Then put files
rsync -avz --exclude='node_modules/' --exclude='_static/' ./test ali:test/
## [without] create ~/test Then put files
## [with] create ~/test Then put files
rsync -avz --exclude='node_modules/' --exclude='_static/' ./test/ ali:test/
# 结论: SRC 中带有 / 则取下级内容,否则取当前文件/文件夹
# 预先是否建立文件夹,没有影响
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment