|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
跟着简明教程学习,在创建备份程序时遇到问题,还请各位大大能给予帮助
这是程序:
import os
import time
source = ['"F:\\Temp"', '"F:\\LY"']
target_dir = 'F:\\Backup'
target = target_dir + os.sep + time.strftime('%Y%m%d%H%M%S') + '.zip'
if not os.path.exists(target_dir):
os.mkdir(target_dir)
zip_command = 'zip -r{0}{1}'.format(target,''.join(source))
print('Zip command is:')
print(zip_command)
print('Running:')
if os.system(zip_command) == 0:
print('Successful backup to', target)
else:
print('Backup FAILED')
这是run后的结果:
Zip command is:
zip -rF:\Backup\20170906140044.zip"F:\Temp""F:\LY"
Running:
zip error: Invalid command arguments (short option ':' not supported)
Backup FAILED
不知问题出在哪 |
|