For an assignment for my internship, I was asked to create a script that moved files around in folders and eventually zipped the contents of a final folder. The desired finish project is a zipped file that when opened will place all 1,348 files into the folder that the .zip file is uncompressed in. Currently, I am running into the problem in which when I unzip my finished file, it reveals the folder in which all the files were originally apart of.
Here is a screenshot of what is produced when I unzip test.zip. As you can see, the "compressed" folder is placed into the folder when I ideally want the contents of "compressed" folder to be there.
NOTICE Well apparently I can't upload an image until I have a higher "reputation". So, imagine a folder with two files in it: test.zip and a folder named "compressed"
Here is my code, thanks for any help!
zf = zipfile.ZipFile("test.zip","w")
for dirname, subdirs, files in os.walk('./compressed'):
for filename in files:
zf.write(os.path.join(dirname,filename))
zf.close