Package com.soklet.util
Class PathUtils
java.lang.Object
com.soklet.util.PathUtils
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionallFilesInDirectory
(Path directory) static void
copyDirectory
(Path sourceDirectory, Path targetDirectory) Copies a directory.static void
copyDirectory
(Path sourceDirectory, Path targetDirectory, Set<Path> pathsToSkip) Copies a directory.static void
deleteDirectory
(Path directory) static void
walkDirectory
(Path directory, PathUtils.FileOperation fileOperation)
-
Method Details
-
deleteDirectory
- Throws:
IOException
-
walkDirectory
public static void walkDirectory(Path directory, PathUtils.FileOperation fileOperation) throws IOException - Throws:
IOException
-
allFilesInDirectory
- Throws:
IOException
-
copyDirectory
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 fromtargetDirectory
- 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 fromtargetDirectory
- the directory to copy intopathsToSkip
- paths that should not be included in the copy, if any- Throws:
IOException
- if an I/O error occurs
-