国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

windows系統中python使用rar命令壓縮多個文件夾示例

2020-02-23 05:21:50
字體:
來源:轉載
供稿:網友

代碼如下:
#!/usr/bin/env python
# Filename: backup_ver1.py

import os
import time

# 1. The files and directories to be backed up are specified in a list.
#source=['/home/swaroop/byte','/home/swaroop/bin']
source=['D://FileCopier//*.*','D://jeecms_doc//*.*']
# If you are using Windows, use source=[r'C:/Documents',r'D:/Work'] or something like that

# 2. The backup must be stored in a main backup directory
#target_dir='/mnt/e/backup/' #Remember to change this to what you will be using
target_dir='E://temp//' #Remember to change this to what you will be using

# 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 zip command (in Unix/Linux) to put the files in a zip archive
#zip_command="zip -qr '%s' %s" %(target,' '.join(source))
zip_command="rar a " + target + ' '.join(source)
# Run the backup
if os.system(zip_command)==0:
 print 'Successful backup to',target
else:
 print 'Backup FAILED'

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 建昌县| 巩义市| 拜城县| 蕲春县| 留坝县| 稷山县| 柘城县| 新竹市| 绿春县| 专栏| 玉山县| 扬中市| 通化市| 肥西县| 涿州市| 陇川县| 夹江县| 河源市| 望江县| 达拉特旗| 南皮县| 渭源县| 南丰县| 台南县| 额尔古纳市| 奉节县| 西城区| 巢湖市| 海阳市| 无为县| 乌审旗| 云霄县| 上高县| 如东县| 武清区| 南丰县| 恩施市| 旬阳县| 井陉县| 罗城| 乌鲁木齐县|