org.apache.commons.io.file

## Class CleaningPathVisitor

- java.lang.Object
- - java.nio.file.SimpleFileVisitor<Path>
  - - org.apache.commons.io.file.SimplePathVisitor
    - - org.apache.commons.io.file.CountingPathVisitor
      - - org.apache.commons.io.file.CleaningPathVisitor

- All Implemented Interfaces:
    FileVisitor<Path>, PathVisitor

      public class CleaningPathVisitor
      extends CountingPathVisitor

  Deletes files but not directories as a visit proceeds.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.commons.io.file.CountingPathVisitor

      `CountingPathVisitor.AbstractBuilder<T,B extends CountingPathVisitor.AbstractBuilder<T,B>>, CountingPathVisitor.Builder`

  - ### Field Summary

    - ### Fields inherited from class org.apache.commons.io.file.CountingPathVisitor

      `EMPTY_STRING_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CleaningPathVisitor(Counters.PathCounters pathCounter, DeleteOption[] deleteOption, String... skip)` Constructs a instance that deletes files except for the files and directories explicitly given.
    `CleaningPathVisitor(Counters.PathCounters pathCounter, String... skip)` Constructs a new instance that deletes files except for the files and directories explicitly given.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `int` | `hashCode()`
    `FileVisitResult` | `preVisitDirectory(Path dir, BasicFileAttributes attributes)`
    `FileVisitResult` | `visitFile(Path file, BasicFileAttributes attributes)`
    `static CountingPathVisitor` | `withBigIntegerCounters()` Constructs a new instance configured with a BigInteger `Counters.PathCounters`.
    `static CountingPathVisitor` | `withLongCounters()` Constructs a new instance configured with a long `Counters.PathCounters`.

    - ### Methods inherited from class org.apache.commons.io.file.CountingPathVisitor

      `accept, defaultDirectoryFilter, defaultDirectoryTransformer, defaultFileFilter, defaultPathCounters, getPathCounters, postVisitDirectory, toString, updateDirCounter, updateFileCounters`

    - ### Methods inherited from class org.apache.commons.io.file.SimplePathVisitor

      `visitFileFailed`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CleaningPathVisitor

          public CleaningPathVisitor(Counters.PathCounters pathCounter,
                                     DeleteOption[] deleteOption,
                                     String... skip)

      Constructs a instance that deletes files except for the files and directories explicitly given.
      Parameters:
        `pathCounter` - How to count visits.
        `deleteOption` - How deletion is handled.
        `skip` - The files to skip deleting.

    - #### CleaningPathVisitor

          public CleaningPathVisitor(Counters.PathCounters pathCounter,
                                     String... skip)

      Constructs a new instance that deletes files except for the files and directories explicitly given.
      Parameters:
        `pathCounter` - How to count visits.
        `skip` - The files to skip deleting.

  - ### Method Detail

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `CountingPathVisitor`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `CountingPathVisitor`

    - #### preVisitDirectory

          public FileVisitResult preVisitDirectory(Path dir,
                                                   BasicFileAttributes attributes)
                                            throws IOException

      Specified by:
        `preVisitDirectory` in interface `FileVisitor<Path>`
      Overrides:
        `preVisitDirectory` in class `CountingPathVisitor`
      Throws:
        `IOException`

    - #### visitFile

          public FileVisitResult visitFile(Path file,
                                           BasicFileAttributes attributes)
                                    throws IOException

      Specified by:
        `visitFile` in interface `FileVisitor<Path>`
      Overrides:
        `visitFile` in class `CountingPathVisitor`
      Throws:
        `IOException`

    - #### withBigIntegerCounters

          public static CountingPathVisitor withBigIntegerCounters()

      Constructs a new instance configured with a BigInteger `Counters.PathCounters`.
      Returns:
        a new instance configured with a BigInteger `Counters.PathCounters`.

    - #### withLongCounters

          public static CountingPathVisitor withLongCounters()

      Constructs a new instance configured with a long `Counters.PathCounters`.
      Returns:
        a new instance configured with a long `Counters.PathCounters`.