Python 创建加密压缩文件

Python 创建加密压缩文件

1. 配置ZLib

http://www.winimage.com/zLibDll/minizip.html

下载之后将 zlibwapi.dll 放在 demo/目录下,与 minizip.exe 一起使用

2. 命令行使用 minizip.exe

 
> minizip.exe

MiniZip 1.01b, demo of zLib + Zip package written by Gilles Vollant
more info at http://www.winimage.com/zLibDll/unzip.html

Usage : minizip [-o] [-a] [-0 to -9] [-p password] file.zip [files_to_add]

  -o  Overwrite existing file.zip
  -a  Append to existing file.zip
  -0  Store only
  -1  Compress faster
  -9  Compress better

3. 配置相关路径,使用python实现

miniZip_path = "youur_path"

def createEncryptedFile(password,zipfile_path,source_path):
    cmd = "{} -o -1 -p {} {} {}".format(miniZip_path,password,zipfile_path,source_path)
    os.system(cmd)
    print(cmd)

测试无误,批处理来一波~~~

4. 同理使用 miniunz.exe 实现解压文件

 

 
 
 
 
 
 

你可能感兴趣的:(我用Python)