public abstract class FileSystemUtils
extends java.lang.Object
File
,
Path
,
Files
Constructor and Description |
---|
FileSystemUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copyRecursively(java.io.File src,
java.io.File dest)
Recursively copy the contents of the
src file/directory
to the dest file/directory. |
static void |
copyRecursively(java.nio.file.Path src,
java.nio.file.Path dest)
Recursively copy the contents of the
src file/directory
to the dest file/directory. |
static boolean |
deleteRecursively(java.io.File root)
Delete the supplied
File - for directories,
recursively delete any nested directories or files as well. |
static boolean |
deleteRecursively(java.nio.file.Path root)
Delete the supplied
File - for directories,
recursively delete any nested directories or files as well. |
public static boolean deleteRecursively(@Nullable java.io.File root)
File
- for directories,
recursively delete any nested directories or files as well.
Note: Like File.delete()
, this method does not throw any
exception but rather silently returns false
in case of I/O
errors. Consider using deleteRecursively(Path)
for NIO-style
handling of I/O errors, clearly differentiating between non-existence
and failure to delete an existing file.
root
- the root File
to deletetrue
if the File
was successfully deleted,
otherwise false
public static boolean deleteRecursively(@Nullable java.nio.file.Path root) throws java.io.IOException
File
- for directories,
recursively delete any nested directories or files as well.root
- the root File
to deletetrue
if the File
existed and was deleted,
or false
it it did not existjava.io.IOException
- in the case of I/O errorspublic static void copyRecursively(java.io.File src, java.io.File dest) throws java.io.IOException
src
file/directory
to the dest
file/directory.src
- the source directorydest
- the destination directoryjava.io.IOException
- in the case of I/O errorspublic static void copyRecursively(java.nio.file.Path src, java.nio.file.Path dest) throws java.io.IOException
src
file/directory
to the dest
file/directory.src
- the source directorydest
- the destination directoryjava.io.IOException
- in the case of I/O errors