Python archiving library (jython)
Is there a neat archiving library that automatically handles archiving a folder or directories for you there? I am using Jython, so Java libraries are open to use as well. -UPDATE- Also Im looking for time archiving. those.
Archive-Dir / 2008/11/16 / zipfilebypreference.zip
then call it again the next day and it will create another folder. I'm sure there is something on the internet, who knows?
+1
source to share
2 answers
You have either:
- gzip library used here in the Jython servlet:
import javax.servlet.http.HttpServlet
import cStringIO
import gzip
import string
def compressBuf(buf):
zbuf = cStringIO.StringIO()
zfile = gzip.GzipFile(mode = 'wb', fileobj = zbuf, compresslevel = 6)
zfile.write(buf)
zfile.close()
return zbuf.getvalue()
- or using java.util.zip directly, as shown in the picture here , for a single file or for the entire contents of a directory.
+3
source to share