I am trying to step through an entire path and its single layer of sub directories. For each file, I need to read five data fields and output them to a delimited text file.
Now to answer your revised post...
You have a bracket in the wrong place:
Files.walkFileTree(startPath, new SimpleFileVisitor(startPath) {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
Files.list(file);
return FileVisitResult.CONTINUE;
}
});
I moved the bracket after new SimpleFileVisitor(startPath)
to enclose the visitFile
method. What you have here is an anonymous class - that's where you provide an implementation "on the fly".