读书人

为何小弟我这个python程序不能执行备份

发布时间: 2012-02-19 19:43:39 作者: rapoo

为何我这个python程序不能执行备份操作?


import os
import time

source = [r'e:\temp', r'e:\test']
target_dir = 'e:\\bak\\'
target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.zip'

zip_command = "zip -qr '%s' %s" % (target,' '.join(source))

if os.system(zip_command) ==0:
print 'Successfull bakcup to',target
else:
print 'Bakcup Failed'

运行却显示:
Bakcup Failed
zip error: Invalid argument

zip error: Could not create output file ('e:/bak/20071108162355.zip')


[解决办法]
你zip命令你个用的不对吧?不是有提示么:
Invalid argument

读书人网 >perl python

热点推荐