FileVisitor

Interface FileVisitor<T>

All Known Implementing Classes:
SimpleFileVisitor
public interface FileVisitor<T>

A visitor of files. An implementation of this interface is provided to the Files.walkFileTree methods to visit each file in a file tree.

Usage Examples: Suppose we want to delete a file tree. In that case, each directory should be deleted after the entries in the directory are deleted.

Path start = ...
     Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
         @Override
         public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
             throws IOException
         {
             Files.delete(file);