基本信息
源码名称:自动备份本地文件至远程服务器
源码大小:2.93KB
文件格式:.py
开发语言:Python
更新时间:2020-10-16
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
if __name__ == '__main__':
host_ip = '10.4.237.174'
host_port = 22
host_username = 'root'
host_password = '6f4w3c7m'
remote_path = '/mongobackups/public_opinions/'
local_path = '/usr/backup/back-all/mongodb-237.174/'
RemoteScp(host_ip, host_port, host_username, host_password, remote_path, local_path)
#--------------------------------------
#time.sleep(10)
today=datetime.date.today().strftime('%Y%m%d')
a=0
for file in os.listdir(local_path):
filename=local_path file
filetime=os.path.getmtime(filename)
timeStruct=time.localtime(filetime)
filetime_str=time.strftime('%Y%m%d',timeStruct)
if filetime_str.find(today)>-1:
a=a 1
if a>0:
# print 'begin_del'
breday = 7
bretime = time.time() - 3600 * 24 * breday
removefiles(bretime, local_path)