Class PathUtils

java.lang.Object
com.soklet.util.PathUtils

public final class PathUtils extends Object
Since:
1.0.0
Author:
Mark Allen
  • Method Details

    • deleteDirectory

      public static void deleteDirectory(Path directory) throws IOException
      Throws:
      IOException
    • walkDirectory

      public static void walkDirectory(Path directory, PathUtils.FileOperation fileOperation) throws IOException
      Throws:
      IOException
    • allFilesInDirectory

      public static List<Path> allFilesInDirectory(Path directory) throws IOException
      Throws:
      IOException
    • copyDirectory

      public static void copyDirectory(Path sourceDirectory, Path targetDirectory) throws IOException
      Copies a directory.

      NOTE: This method is not thread-safe.

      Most of the implementation is thanks to http://stackoverflow.com/questions/17641706/how-to-copy-a-directory-with-its-attributes-permissions-from-one -location-to-ano/18691793#18691793

      Parameters:
      sourceDirectory - the directory to copy from
      targetDirectory - the directory to copy into
      Throws:
      IOException - if an I/O error occurs
    • copyDirectory

      public static void copyDirectory(Path sourceDirectory, Path targetDirectory, Set<Path> pathsToSkip) throws IOException
      Copies a directory.

      NOTE: This method is not thread-safe.

      Most of the implementation is thanks to http://stackoverflow.com/questions/17641706/how-to-copy-a-directory-with-its-attributes-permissions-from-one -location-to-ano/18691793#18691793

      Parameters:
      sourceDirectory - the directory to copy from
      targetDirectory - the directory to copy into
      pathsToSkip - paths that should not be included in the copy, if any
      Throws:
      IOException - if an I/O error occurs