10 Star 33 Fork 17

hxt168/mongodb_backup_script

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test_del_old_backup_on_oss.py 902 Bytes
一键复制 编辑 原始数据 按行查看 历史
hanxuetong 提交于 2016-07-14 21:14 . add
#!/usr/bin/env
import fun
import time
import config
from oss.oss_util import *
# need delete filename prefix
oss_file_pre="mongodb_cycle_backup_test_titan_"
# not delete file dir
un_delete_file_dir=["mongodb_cycle_backup_test_titan_20151123152558"]
def check_in_array():
if "healing potion" in inventory:
print "You will live to fight another day."
if __name__ == "__main__":
start_time = time.time()
oss=fun.get_oss_connect(config.endpoint, config.accessKeyId, config.accessKeySecret);
file_list_on_oss=fun.list_bucket_files(oss,config.bucket,oss_file_pre)
for each in file_list_on_oss:
file_name=each[0];
file_dir_name=file_name.split("/")[0]
print(file_dir_name)
if file_dir_name not in un_delete_file_dir:
fun.del_bucket_file(oss,config.bucket,file_name)
print("del "+file_name)
fun.print_cost_time("all done ", start_time)
fun.list_bucket_files(oss,config.bucket)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/passer/mongodb_backup_script.git
git@gitee.com:passer/mongodb_backup_script.git
passer
mongodb_backup_script
mongodb_backup_script
master

搜索帮助