daydreamer
daydreamer

Reputation: 92179

How to create zip file using TrueZip?

The example on their website is

File entry = new TFile("archive.zip/dir/HälloWörld.txt");
Writer writer = new TFileWriter(entry);
try {
    writer.write("Hello world!\n");
} finally {
    writer.close();
}

In my use case, I have the following structure

log/a.log
log/b.log
log/morelog/1.log
c.log
d.log

I want to zip all of them. As per example, they create entry and write data into it.

Question
- if I need to copy the data from eachfile like this, this would be inefficient, right?

How can I just give filepaths and tell it to create zip?

Upvotes: 1

Views: 404

Answers (1)

Christian Schlichtherle
Christian Schlichtherle

Reputation: 3155

For copying, have a look at TFile.cp_rp(File).

Upvotes: 3

Related Questions