如何绕过java.nio.file.DirectoryNotEmptyException? [英] How to bypass java.nio.file.DirectoryNotEmptyException?
本文介绍了如何绕过java.nio.file.DirectoryNotEmptyException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以绕过java.nio.file.DirectoryNotEmptyException?我希望能够删除其中包含内容的文件夹.
Is there a way to bypass a java.nio.file.DirectoryNotEmptyException? I want to be able to delete a folder with content in it.
推荐答案
有没有办法绕过
java.nio.file.DirectoryNotEmptyException
?
不.没有办法绕过它.
在Linux/Unix上,限制最终是由操作系统施加的.请参见 man 2 rmdir
和ENOTEMPTY
错误代码.
On Linux / Unix, the restriction is ultimately imposed by the operating system. See man 2 rmdir
, and the ENOTEMPTY
error code.
此外,尝试从命令提示符下运行 rmdir
一个非空目录,然后看看会发生什么.
Also, try running rmdir
from the command prompt on a non-empty directory, and see what happens.
在其他注释状态下,您需要先清空目录.
As other comments state, you need to empty the directory first.
这篇关于如何绕过java.nio.file.DirectoryNotEmptyException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文