need to read the config file and then zip files in path. dont get any errors but files not zipping
# config file
[clean1]
path = C:/Project/Log1
action=zip
[clean2]
path = C:/Project/Log2
action = zip
#zip.py
import zipfile, os, time, sys, ConfigParser, zlib
def zip_fh():
zip = zipfile.ZipFile('%s.zip' % (path), 'w')
for root, dirs, files in os.walk(path, topdown=True):
for files in files:
file_fh = os.path.join(root, file)
zip.write(file_fh, os.path.basename(file_fh), zipfile.ZIP_DEFLATED)
zip.close()
def main():
julian = time.strftime('%j', time.localtime())
zip_fh = 'C:\Documents and Settings\file.cfg'
conf_config = ConfigParser.ConfigParser()
conf_config.read(zip_fh)
for section in conf_config.sections():
path = conf_config.get(section, 'path')
print path
for root, dirs, files in os.walk(path, topdown=True):
for file in files:
fh = os.path.join(root, file)
zip_fh()
if __name__=="__main__":
main()