python 备份文件

来源:互联网 发布:利用mysql 入侵linux 编辑:程序博客网 时间:2024/05/28 03:02

 

# -*- coding: utf-8 -*-
import os
import time

source = ['D://vooyo//prj//WVM']

target_dir = 'H://'

for i in source:
    print 'dir = ',i

target = target_dir +'wvm'+time.strftime('%Y%m%d%H%M%s') + '.zip'

zip_command = "rar a %s %s" % ( target, ' '.join(source) )

print zip_command

if os.system(zip_command) == 0:
    print '备份成功'
else :
    print os.system(zip_command)
    print '备份失败'

原创粉丝点击