#!/usr/bin/python #Filename: backup_hxy.py import os import time # source files and directories to be backed up in a list. source = ['D:\My test\Github', 'D:\My test\OpenCV'] #backup dir target_dir = 'D:\My test\python' #target name target = target_dir + time.strftime('%Y %m %d %H %M %S') + '.zip' zip_command = "zip-qr '%s' %s" % (target,''.join(source)) #run the backup if os.system(zip_command) == 0: print ('successful backup to', target) else: print ('backup failed')
python学习之 打包脚本
最新推荐文章于 2024-08-21 17:14:07 发布