How to change the file's permission and last modified in Java?

岁酱吖の 提交于 2019-12-22 16:29:39

问题


To my knowledge, Java's File class does not support to change the file's permission and last modified date. Is there any proper way to do this in a cross-platform style?


回答1:


I'm looking at the Java 6 documentation, and there is a setLastModified() method, as well as setReadable(...) and setWritable(...) and setExecutable(...) methods (all in the java.io.File class). So yes, there is a way...



来源:https://stackoverflow.com/questions/459622/how-to-change-the-files-permission-and-last-modified-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!