質問

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