I'm trying to use shutil.make_archive but it's duplicating the folder name. Let me explain better:
My folder R360
to be ziped is located at: C:\Users\PycharmProjects\Project\media\SAE\R360\
What I am trying to do is: create a zip folder with this same name. So in the SAE directory, it should be the regular folder R360
and then R360.zip
.
My code:
folder = C:\Users\PycharmProjects\Project\media\SAE\R360
mediaFolder = C:\Users\PycharmProjects\Project\media\
shutil.make_archive(f'{folder}', 'zip', f"{mediaFolder}SAE/", f"{folder.split('/')[-1]}/")
The R360.zip
is being created normally but the problem is that the zip folder is like this:
C:\Users\PycharmProjects\Project\media\SAE\R360.zip\R360\...
What I really wanted:
C:\Users\PycharmProjects\Project\media\SAE\R360.zip\...
It shouldn't be that R360
inside the zip folder.