• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > windows系统中python使用rar命令压缩多个文件夹示例

windows系统中python使用rar命令压缩多个文件夹示例

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了windows7加密文件夹,c盘windows文件夹太大,windows文件夹太大,windows文件夹,windows字体文件夹等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

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'
</div>

</div>

您可能想查找下面的文章:

  • windows系统中python使用rar命令压缩多个文件夹示例
  • windows系统中python使用rar命令压缩多个文件夹示例

相关文章

  • 详解在Python程序中使用Cookie的教程
  • Python操作sqlite3快速、安全插入数据(防注入)的实例
  • 仅用500行Python代码实现一个英文解析器的教程
  • 详解Python中的__new__()方法的使用
  • python实现合并两个数组的方法
  • TFRecord格式存储数据与队列读取实例
  • python回溯法实现数组全排列输出实例分析
  • Python语言实现获取主机名根据端口杀死进程
  • Python的多态性实例分析
  • 详解Python中__str__和__repr__方法的区别

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • python友情链接检查方法
    • python文件与目录操作实例详解
    • 查看Python安装路径以及安装包路径小技巧
    • 解析Python中的__getitem__专有方法
    • python解析xml文件操作实例
    • Python实现的简单文件传输服务器和客户端
    • NumPy排序的实现
    • Python的Bottle框架中获取制定cookie的教程
    • 用Python实现斐波那契(Fibonacci)函数
    • python 切片和range()用法说明

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有