I have a java application that sits in C:\java\app\ The application downloads files and places them in C:\java\app\temp. I want to zip these files and then email them off to a different server. The issue i am having is that when i zip the files it holds on to the folder structure. So when i unzip, it unzips them to whateverDirIamIn\c:\java\app\temp. Is it possible to zip just the files without holding onto the directory?
If i dont use a temp folder and just store the files in c:\java\app i get the desired results, however i would like to use a temp folder, in case there is a program crash or something i do not want to leave all the files in the .\app folder. I can reduce the file structure by adding the files to the zip with .\temp\filename but that still holds on to the .\temp structure. Any thoughts or ideas are appreciated. Thanks!
If you don't want a directory/path for files in the zip file you create,
don't put them in the ZipEntry() constructor call. Just put in the file name.
Thanks Norm, do you have an example of this? I have been looking at the documentation for Class ZipOutputStream, the only way i can see to get around using ZipEntry() is to use the ZipOutputStream.write(byte b, int off, int len) which i think means i would have to handle the files at the byte level, i like using the File class, it is much simpler : )
I was able to find a detailed example of this, thanks for getting me on the correct path Norm. I tried to post the link in case others would like to see it, but i dont have 20 posts so it will not allow me to post a link, sorry.