So I’m working on a program which will make it easier for me to organize my image files. However I have run into a problem, I would like to zip the thumbnails the program generates when it detects a new image. But this is more difficult than I thought in java, since it’s not possible to add a new file to an existing zip file, instead the whole zip file must be recreated. So I’m wondering, is there any other way to bundle the thumbnails into a single file?
…why don’t you just recreate the zip file then?
Here is code that does it for you. It was the first result for googling “java add file to zip”.
I was hoping there was a better way to do it. But it seems like I have to do it that way.
Edit: I’m now finished with my zipping code, and it turned out better than I thought. My worry was that I would keep recreating the same zip over and over again, but then I realized that I could just generate all the thumbnails in a temp folder, and then zip all at once, so only one recreation of the zip file is needed.