3

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

epiphany
  • 756
  • 1
  • 11
  • 29
  • Are you sure your folder path is correct? If you use an absolute path, maybe your file(or dir) path should prefix with driver letter.(e.g. D:/A_dest) – Xiao Tan Sep 29 '18 at 14:29
  • Have tried to use D:/A_dest with no luck, just starting to learn this – epiphany Sep 29 '18 at 14:31
  • As my comment says you should change your path on Windows. https://stackoverflow.com/questions/2953834/windows-path-in-python – Xiao Tan Sep 29 '18 at 14:34

1 Answers1

1

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

SocketPlayer
  • 166
  • 6