import os
import time
source= r"out_res.txt"
target_dir= r"F:\python\Doc"
target=target_dir+time.strftime(‘%Y%m%d%H%M%S‘)+‘.zip‘
zip_commond="makecab %s %s " %(source,target)
print ‘\n Run the backup:‘,
print zip_commond+‘\n‘
if os.system(zip_commond)==0:
print ‘Successful backup to ‘,target
else:
print ‘Backup Failed.‘
原文地址:http://www.cnblogs.com/charlie-badegg/p/3862341.html