📄 backup_ver1.py
字号:
# Filename: backup_ver1.py
import os
import time
import sys
sys.path.append('C:\\program files\\winrar')
# 1. The files and directories to be backed up are spectified in a list.
source = ['E:\\AIMAPythonCodes\\PythonLearning\\*.*', 'E:\\AIMAPythonCodes\\*.py'] # Windows
# 2. The backup must be stored in main backup directory
target_dir = 'E:\\DVDTEMp\\'
# 3. The files are backed up into a zip file.
# 4. The name of the zip archive is the current date and time
target = target_dir + time.strftime('%Y%m%d%H%M%S') + '.zip'
# 5. We use the winrar comand line
zip_command = "winrar a %s %s"%(target, ' '.join(source))
if os.system(zip_command) == 0:
print 'Successful backup to', target
else:
print 'Backup FAILED'
print zip_command
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -