通过java应用程序隐藏文件夹(以便从Windows设置中也无法读取文件夹)
我试过这个然而我想从Windows资源管理器中也不应该看到它。
public static void main(String[] args) throws SecurityException {
Path path = FileSystems.getDefault().getPath("\\rd2");
try {
Files.setAttribute(path, "dos:hidden", true);
} catch (UnsupportedOperationException x) {
System.err.println("DOS file" +
" attributes not supported:" + x);
}
我试过这个但没有得到结果.. 任何人都可以帮我解决这个问题..
String path="\\r1";
File file = new File(path);
if (!file.exists()) {
if (file.mkdir()) {
file.setReadable(false);
file.setExecutable(false);
file.setWritable(false);
System.out.println("Directory is created!");
} else {
System.out.println("Failed to create directory!");
}
}
任何人都可以帮我解决这个问题..