create zip files under python
#!/usr/bin/python import os, os.path, glob, zipfile DIR=”/home/kraneis/” # change to directory os.chdir(DIR) # read a content fList=glob.glob(‘pythonbsp/test/*’) print “It exist ” + str(len(fList))+ ” files” filelist = [ fn for fn in fList if os.path.isfile(fn)] print “here are the files” print filelist z=zipfile.ZipFile(“/tmp/test.zip”,’w’,zipfile.ZIP_DEFLATED) print “the methods for z objects” print [s for s in dir(z) […]
Tagged python