문제

I have created a zip file using java zip utility and I have following directory structure inside that zip file.

  1. test.txt - file
  2. mylabel.lbl - file
  3. aux - directory (inside this directory I have some other files like following)
    1. myfile.lbl
    2. 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top