java 为文件及文件夹添加权限
生活随笔
收集整理的這篇文章主要介紹了
java 为文件及文件夹添加权限
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
/*** 增加權限,使路徑可上傳文件*/
public static void addChmod777(String filePath) throws IOException {if (!System.getProperty("os.name").startsWith("Win")) {String cmdGrant = "chmod 777 " + filePath;BaseLogMethod.logInfo(TAG, "File Augmentation after Moving:" + cmdGrant);Runtime.getRuntime().exec(cmdGrant);}
}/*** 增加權限,使路徑及子路徑都有權限*/
public static void addRChmod777(String filePath) throws IOException {if (!System.getProperty("os.name").startsWith("Win")) {String cmdGrant = "chmod -R 777 " + filePath;BaseLogMethod.logInfo(TAG, ".addRChmod777: File Augmentation after Moving:" + cmdGrant);Runtime.getRuntime().exec(cmdGrant);}
}
總結
以上是生活随笔為你收集整理的java 为文件及文件夹添加权限的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 英伟达NVIDIA显卡控制面板无法打开已
- 下一篇: RPC远程过程调用之 RMI实现