#!/usr/bin/Python # Filename: backup_ver1.py import os import time source =[r'D:\shi1', r'D:\shi2'] target_dir = 'F:\\back\\' # 文件夹路径用“\\”表示,这个winrar来决定的 #中文注释和英文注释不一样吗 #you will be using target = target_dir + time.strftime('%Y%m%d%H%M%S') + '.zip' zip_command= '"C:\Program Files\WinRAR\WinRAR.exe" a %s %s'%(target,' '.join(source)) # Run the backup if os.system(zip_command) == 0: print 'Successful backup to', target else: print os.system(zip_command) print 'Backup FAILED'