everyone. I'm really new to Python, so I need some help here.
I have a list of folders names inside a .CSV
file. All these folders are inside the same path.
I need to zip them individually (each one needs to become a .ZIP
file, maintaining its own original name) and, after zipping, delete the original folders.
Tried some things here, but had no success :(
I read about zipfiles
, os.walk
, import csv
, but I can't get these things together.
Can someone help me with this one?
The code is here. I'm really sorry, it probably makes no sense as it is. I'm really a begginer :(
import os
import zipfile
import csv
import sys
os.chdir('dir')
files='dir'
for i in range (len(files)):
with zipfile.ZipFile(files(i)+'.zip', 'w') as zipMe:
zipMe.write(files[i], compress_type=zipfile.ZIP_DEFLATED)