FileUtils
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
工具类包括FileUtils、IOUtils、FilenameUtils和FileSystemUtils
在线api说明
https://commons.apache.org/proper/commons-io/apidocs/index.html
FileUtils主要用法:
copyFile:文件到文件
copyFileToDirectory:目录到文件
copyInputStreamToFile:输入流到文件
copyToDirectory:文件或目录到目录
copyToFile:文件或者目录到文件
copyDirectory:目录到目录
deleteDirectory(File directory):Deletes a directory recursively.
deleteQuietly(File file):Deletes a file, never throwing an exception.
forceDelete(File file):Deletes a file.
cleanDirectory(File directory):Cleans a directory without deleting it.