为何我这个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