The attached code zips up all the files present in C:\abc\ss into C:\Abc.zip at the top level. When I open up the zip file using WinZip and extract the file into another folder temp, the subfolders "abc" and "ss" are lost. All the files are getting extracted to the top level only i.e. C:\temp. ( and not C:\temp\abc\ss).
How can I change this code to make sure that the sub folders also get zipped during the process?
File inFolder=new File("C:\\abc\\ss");
File outFolder=new File("C:\\Abc.zip");
ZipOutputStream out = new ZipOutputStream(new
BufferedInputStream in = null;
byte data = new byte;
String files = inFolder.list();
for (int i=0; i<files.length; i++)
in = new BufferedInputStream(new FileInputStream
(inFolder.getPath() + "/" + files[i]), 1000);
while((count = in.read(data,0,1000)) != -1)
out.write(data, 0, count);