类 FileSystemUtils
java.lang.Object
cn.taketoday.util.FileSystemUtils
Utility methods for working with the file system.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidcopyRecursively(File src, File dest) Recursively copy the contents of thesrcfile/directory to thedestfile/directory.static voidcopyRecursively(Path src, Path dest) Recursively copy the contents of thesrcfile/directory to thedestfile/directory.static booleandeleteRecursively(File root) Delete the suppliedFile- for directories, recursively delete any nested directories or files as well.static booleandeleteRecursively(Path root) Delete the suppliedFile— for directories, recursively delete any nested directories or files as well.
-
构造器详细资料
-
FileSystemUtils
public FileSystemUtils()
-
-
方法详细资料
-
deleteRecursively
Delete the suppliedFile- 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 returnsfalsein case of I/O errors. Consider usingdeleteRecursively(Path)for NIO-style handling of I/O errors, clearly differentiating between non-existence and failure to delete an existing file.- 参数:
root- the rootFileto delete- 返回:
trueif theFilewas successfully deleted, otherwisefalse
-
deleteRecursively
Delete the suppliedFile— for directories, recursively delete any nested directories or files as well.- 参数:
root- the rootFileto delete- 返回:
trueif theFileexisted and was deleted, orfalseif it did not exist- 抛出:
IOException- in the case of I/O errors
-
copyRecursively
Recursively copy the contents of thesrcfile/directory to thedestfile/directory.- 参数:
src- the source directorydest- the destination directory- 抛出:
IOException- in the case of I/O errors
-
copyRecursively
Recursively copy the contents of thesrcfile/directory to thedestfile/directory.- 参数:
src- the source directorydest- the destination directory- 抛出:
IOException- in the case of I/O errors
-