Reputation: 1
With the use of createZipReport, I am adding list of files and folders to be zipped up. The createZipReport then calls the zipFileList to zip up the whole folder.
The question is I need to zip a folder inside this already existing folder without changing much.
For example
Directory.zip
Files
SubFolder1
SubFolder2
The files, subFolder1 and subFolder2 are added with the help of fileList in createZipReport
Now I need the subFolder1 to be a zip folder i.e.SubFolder1.zip
Any suggestions?
Upvotes: 0
Views: 294
Reputation: 18255
You can create new or use existed zip file to add new files and folers with zip4jvm
Path zip = Paths.get("filename.zip");
Collection<Path> paths = Arrays.asList(
Paths.get("/bikes/ducati-panigale-1199.jpg"),
Paths.get("/bikes/honda-cbr600rr.jpg"),
Paths.get("/cars"),
Paths.get("/saint-petersburg.jpg"));
ZipIt.zip(zip).add(paths);
When you do it multiple times, your existed zip file will not be corrupted and all entires will be there.
Upvotes: 0