python (jython) archiving library
Question
Is there a neat archiving library that automatically handles archiving a folder or directories for you out there? I am using Jython, so Java libs are also open for use. -UPDATE- Also Im looking for timestamp archiving. ie
archive-dir/2008/11/16/zipfilebypreference.zip
then the next day call it again and it creates another folder. Im sure there is something out there on the internet, who knows?
Solution
You have either the:
- gzip library used here in a 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 the direct used of java.util.zip as illustrated here, for one file, or for a all directory content.
OTHER TIPS
You can use java.util.zip, when I was using Jython the built in zip library in python didn't work
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow