python windows备份文件info-zip
import osimport time
#1.需要备份的文件或者文件夹
source = ['d:\\sll','D:\\download']
#2.需要备份的存放目录
target_dir = 'd:\\pyback\\'
#3要压缩的文件
target = target_dir + time.strftime('%Y%m%d%H%M%S')+'.zip'
print target
zip_command = "zip -qr %s %s" % (target,' '.join(source))
print zip_command
if os.system(zip_command) == 0:
print 'Successfull back to',target
else:
print 'backup failed'
页:
[1]