epiphany
epiphany

Reputation: 766

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

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

Upvotes: 3

Views: 174

Answers (1)

SocketPlayer
SocketPlayer

Reputation: 166

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

Upvotes: 1

Related Questions