Noam
Noam

Reputation: 3145

Archive a folder in Java using truezip

I need to create a service that finds specific folders and archives them into on zip file.

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)?

I want to use truezip since I understood you could easily add files/folders to a zip file.

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.

I'm using Java 6. How to archive a folder in Java using truezip?

EDIT: Also found this example.

Upvotes: 3

Views: 1897

Answers (1)

Christian Schlichtherle
Christian Schlichtherle

Reputation: 3155

Using TrueZIP, all you need to call is

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

Upvotes: 1

Related Questions