Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3 cannot zip a folder and move it to another folder

Tags:

python

I m currently using the shutil library to zip the file,

Current folder structure

In the d drive

A_zipdirectory.py for running the python code

A_dest folder to be zipped

A_backup folder that will stored the zipped folder

Python code

import shutil

import logging
import sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

zip_loc = 'D:/A_dest'
zip_dest = 'D:/A_backup'
shutil.make_archive(base_dir=zip_loc, root_dir=zip_loc, format='zip', 
base_name=zip_dest)

When i run this, No error occurs, but i cannot zip and move the file to the backup folder, Any idea? Many thanks

enter image description here

like image 728
epiphany Avatar asked Dec 27 '25 22:12

epiphany


1 Answers

try to add logger and see what happening. (you can deliver logger to shutil.make_archive)

sorry it answer and not comment, i can't comment yet

like image 135
SocketPlayer Avatar answered Dec 30 '25 23:12

SocketPlayer