#!/usr/bin/python
# Filename: backup_ver1.py
import os
import time
source = [r'C:\Users\t_dingfeny\Desktop\pythonStudy\cleanupTest',
r'C:\Users\t_dingfeny\Desktop\pythonStudy\PSNRtest4']
target_dir = r'C:\Users\t_dingfeny\Desktop\pythonStudy'
target = target_dir + '\\' + time.strftime('%Y%m%d%H%M%S') + '.rar'
rar_command = "rar a %s %s" % (target, ' '.join(source))
#rar_command = "dir"
if os.system(rar_command) == 0:
print 'Successful backup to', target
else:
print 'Backup FAILED'
python windows rar 压缩文件
最新推荐文章于 2022-10-21 23:44:23 发布