I'm using this basic script in Python 2.6 to zip a directory :
def zipdir(path, ziph):
import os, zipfile
for(dir, _, files) in os.walk(path):
for file in files:
ziph.write(os.path.join(dir, file))
ziph = zipfile.ZipFile(name + '.zip', 'w', zipfile.ZIP_DEFLATED)
path = 'c:/test/directory'
The problem is inside my new zip file.
For example, my target folder to zip is on c:/test/directory/myfiles
So when I zip it, instead of getting : file.zip/directory/myfiles,
I have : file.zip/test/directory/myfiles
I don't want to keep the "test" folder.
Someone could tell me how to fix it ?