Reputation: 619
I want to have a folder called 'product_a1' in a folder called 'product_a1' with a text file and process flag files such as 'completed' file. I want to zip the entire thing so it can be put onto a ftp server. The server is currently PHP using 7zip, and expects this structure, but I need to do this using Python code. Its the structure that's important here as ShUtil defaults to single level folder, and so does python 7zip etc.
/product_a1/product_a1/my_file.txt
/completed
/etc
Upvotes: 1
Views: 45
Reputation: 50
You can try using py7zr, which supports 7zip archive compression, decompression, encryption, decryption.
Here is a simple example to make 7-zip archive. https://py7zr.readthedocs.io/en/stable/user_guide.html#make-archive
import py7zr
with py7zr.SevenZipFile("Archive.7z", 'w') as archive:
archive.writeall("target/")
Upvotes: 1