files 2

简介: files 2

移动文件 Path source = Paths.get("helloword/data.txt"); Path target = Paths.get("helloword/data.txt");

Files.move(source, target, StandardCopyOption.ATOMIC_MOVE);

StandardCopyOption.ATOMIC_MOVE 保证文件移动的原子性

删除文件

Path target = Paths.get("helloword/target.txt");

Files.delete(target); 如果文件不存在,会抛异常 NoSuchFileException

删除目录

Path target = Paths.get("helloword/d1");

Files.delete(target); 如果目录还有内容,会抛异常 DirectoryNotEmptyException



目录
相关文章
|
C#
C# File、FileInfo、Directory、DirectoryInfo
本文主要介绍文件类、文件信息类、目录类、目录信息类的常用属性和方法
74 0
|
缓存 JavaScript
Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs‘TypeError: Cannot read proper
Error: EPERM: operation not permitted, mkdir ‘C:\Program Files\nodejs‘TypeError: Cannot read proper
199 0
Get Files In Folder [ DTFolderFiles ] Plug-in description
Get Files In Folder [ DTFolderFiles ] Plug-in description
84 0
3.4 Files
3.4 Files
73 0
Get Files In Folder [ DTFolderFiles ] 插件说明
Get Files In Folder [ DTFolderFiles ] 插件说明
104 0
Get Files In Folder [ DTFolderFiles ] 插件说明
|
JavaScript
The file is in the program because: Imported via xxx Root file specified for compilation Vetur(1261)
The file is in the program because: Imported via xxx Root file specified for compilation Vetur(1261)
225 0
The file is in the program because: Imported via xxx Root file specified for compilation Vetur(1261)
|
C语言 Python Windows
gcc: error: /FIPython.h: File o directory non esistente
gcc: error: /FIPython.h: File o directory non esistente
151 0
objdump: ‘1443.14.0)‘: No such file or directory
objdump: ‘1443.14.0)‘: No such file or directory
123 0
No such file or directory
No such file or directory
348 0
No such file or directory
curses.h: No such file or directory
curses.h: No such file or directory
143 0

热门文章

最新文章