spring-framework / org.springframework.util / FileSystemUtils / deleteRecursively

deleteRecursively

open static fun deleteRecursively(@Nullable root: File): Boolean

Delete the supplied 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.

Parameters

root - the root File to delete

Return
true if the File was successfully deleted, otherwise false

open static fun deleteRecursively(@Nullable root: Path): Boolean

Delete the supplied File - for directories, recursively delete any nested directories or files as well.

Parameters

root - the root File to delete

Exceptions

IOException - in the case of I/O errors

Return
true if the File existed and was deleted, or false it it did not exist

Since
5.0