简体   繁体   English

python(jython)归档库

[英]python (jython) archiving library

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. 我正在使用Jython,因此Java库也可以使用。 -UPDATE- Also Im looking for timestamp archiving. -UPDATE-我也正在寻找时间戳存档。 ie

archive-dir/2008/11/16/zipfilebypreference.zip 归档目录/ 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? 我确定互联网上有什么东西,谁知道呢?

You have either the: 你有:

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. 或者如图所示java.util.zip直接用在这里 ,一个文件,或为所有目录中的内容。

你可以使用java.util.zip,当我使用Jython时,python中的内置zip库不起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM