I have created a zip file using java zip utility and I have following directory structure inside that zip file.
- test.txt - file
- mylabel.lbl - file
- aux - directory (inside this directory I have some other files like following)
- myfile.lbl
- firstfile.txt
String dir = "aux\\";
Iterator<LabelFile> i = auxLabelFiles.iterator();
while (i.hasNext()) {
LabelFile labelFile = i.next();
String lableFileName = labelFile.getMetadata().getLabelFileName();
zipEncorder.addToZip(dir + lableFileName, labelFile.getMedia().getByteData());
}
This is code only 'aux' directory and once the file is downloaded in can be opened with 7zip and shows directory structure correctly.
When I try to unzip zip file with WinRAR it unzips all only outer directory files with an error message. 'cannot create aux\myfile.lbl system cannot find the path specified'
I cannot guess is this an issue with the file was created or WinRAR issue.
Any comment is appreciated.
Thanks, Dil.
The problem is directory aux
in the ZIP archive as AUX is a reserved name which cannot be used as name for a file or directory on Windows, see MSDN article Naming Files, Paths, and Namespaces. Therefore renaming the directory to something different like Auxiliary
solves the problem.