程序员最近都爱上了这个网站  程序员们快来瞅瞅吧!  it98k网:it98k.com

本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

简明python教程的例程 备份文件夹 的winrar的用法,编译成功了

发布于2019-09-02 14:55     阅读(1207)     评论(0)     点赞(11)     收藏(0)


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




所属网站分类: 技术文章 > 博客

作者:83748wuw

链接:https://www.pythonheidong.com/blog/article/81211/b6d708f68861cc181066/

来源:python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

11 0
收藏该文
已收藏

评论内容:(最多支持255个字符)