Forums Register Login

zip files without path info...

+Pie Number of slices to send: Send
I don't know if this is the best board for the question, but I am trying to do this from a servlet, so...

I am using ZipOutputStream to create zip file containing 3 files on our server. I don't want to files to be inside directories when they are zipped, so how do I add them without the path information?



The 3 filenames all include the full server path to the file and they are getting added to the archive inside a directory structure that matches the server path.

TIA.
+Pie Number of slices to send: Send
Moved to the I/O forum.
+Pie Number of slices to send: Send
just guessing

try changing

// Add ZIP entry to output stream.
zos.putNextEntry(new ZipEntry(filenames[i]));



to

+Pie Number of slices to send: Send
Thanks! I was able to get it working with the following changes:



The ZipEntry is what controls how it is represented in the zip file.

-Eric
[ December 13, 2005: Message edited by: Eric Martin ]
He's giving us the slip! Quick! Grab this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2646 times.
Similar Threads
Zipping files
ZipOutputStream
zip file does not contain any text file ??
displaying an image of type TIF
Compress .zip using Java
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:42:05.