时间:2021-05-22
复制代码 代码如下:
#!/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'
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
本次示例主要实现:1.压缩文件夹及其下文件2.压缩文件夹下文件3.压缩文件夹及其下文件为rar还是zip4.解压缩5.加密压缩及解加密压缩-----------
Java解压缩zip-多个文件(包括文件夹),具体如下:对多个文件和文件夹进行压缩,对复杂的文件目录进行解压。压缩方法使用的是可变参数,可以压缩1到多个文件..
需求:将Linux系统的的某个文件夹(里面包含文件夹和文件)下载到我Windows系统某个文件夹里之前我使用xshell下载,但是通过rz:上传sz:下载命令中
Java解压缩zip-多个文件(包括文件夹),对多个文件和文件夹进行压缩,对复杂的文件目录进行解压。压缩方法使用的是可变参数,可以压缩1到多个文件..可以写数组
邮件不能发文件夹,可以选择把该文件夹进行压缩后发送,一些网站的邮箱附件可以是文件夹,但是大多数的还只是支持文件,压缩成rar或者zip文件即可。 邮件是指经传