其他分享
首页 > 其他分享> > rsync exclude选项在bash脚本中不生效

rsync exclude选项在bash脚本中不生效

作者:互联网

执行/usr/bin/rsync -av --delete --exclude /usr/local/openresty/nginx/html/Uploadfile/xxxx /usr/local/openresty/nginx/html/Uploadfile /mnt时

排除选项可生效,但将该语句放入bash脚本中执行则排除选项不生效

解决办法

写入py脚本中调之,注意--exclude 后排除目录应用双引号引起来

 1 #!/usr/local/bin/python3
 2 # coding:utf-8
 3 
 4 
 5 # ====================================================
 6 # Author: changbo - 541330702@qq.com
 7 # Last modified: 2022-01-05
 8 # Filename: filesyn.py
 9 # Description:  file bak
10 # http://www.cnblogs.com/changbo
11 # ====================================================
12 
13 import os
14 command1 = '/usr/bin/rsync -av --delete --exclude "/usr/local/openresty/nginx/html/Uploadfile/xxx" /usr/local/openresty/nginx/html/Uploadfile /mnt'
15 result = os.system(command1)
16 print(result)

END!

 

标签:rsync,Uploadfile,--,html,usr,exclude,local,bash
来源: https://www.cnblogs.com/changbo/p/15767046.html