简体   繁体   English

使用truezip在Java中归档文件夹

[英]Archive a folder in Java using truezip

I need to create a service that finds specific folders and archives them into on zip file. 我需要创建一个服务,找到特定的文件夹并将它们存档到zip文件中。

I saw all kind of examples , but it seems that have to read all the files in every folder. 我看到了各种各样的例子 ,但似乎必须阅读每个文件夹中的所有文件。 Am I right? 我对吗?

Is there another way to do that (maybe using truezip for that matter)? 有没有其他方法可以做到这一点(也许使用truezip)?

I want to use truezip since I understood you could easily add files/folders to a zip file. 我想使用truezip,因为我知道你可以轻松地将文件/文件夹添加到zip文件中。

I've searched for a simple example of archiving a folder using truezip - but I couldn't find anything useful - I need a simple example of how to archive a given folder . 我已经搜索了一个使用truezip归档文件夹的简单示例 - 但我找不到任何有用的东西 - 我需要一个如何归档给定文件夹的简单示例

I'm using Java 6. How to archive a folder in Java using truezip? 我正在使用Java 6.如何使用truezip在Java中归档文件夹?

EDIT: Also found this example . 编辑:也找到了这个例子

Using TrueZIP, all you need to call is 使用TrueZIP,您只需要拨打电话即可

new TFile("folder").cp_rp(new TFile("archive.zip"));

I suggest to read it's tutorial in order to get a better understanding of what it all means: TrueZIP Tutorial 我建议阅读它的教程,以便更好地理解它的含义: TrueZIP教程

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

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