问题
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