I am trying to walk through a zip file and print out all files, but for some reason, it throws a NoSuchFileException
as soon as it goes into any subfolder.
FileSystem fs = FileSystems.newFileSystem(Paths.get(folder.getRoot().getAbsolutePath(), "test.zip"), null);
Files.walkFileTree(fs.getPath("/"), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attr) {
System.out.println(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) {
System.err.println(exc);
return FileVisitResult.CONTINUE;
}
});
How come it even wants to go there if they don't exist? Can anyone help me to solve this problem? The files should actually be there, at least they do when the test is executed by hand.