#!/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'