1
嗨,所以我正在編寫一個運行幾個腳本的小應用程序我編寫的腳本都存儲在一個目錄中,並偶爾會更改腳本,這是一些不時刪除/添加在我的服務器上,所以我需要從應用程序運行一個命令遞歸地chmod腳本運行前的目錄中的所有文件我使用下面的代碼chmod文件,但無法弄清楚如何做到這一點在目錄Android應用程序運行命令遞歸
所有文件謝謝您的幫助
//Code to chmod the file
execCommand("busybox chmod 755 ");
//execCommand Method
public Boolean execCommand(String command) {
try {
Runtime rt = Runtime.getRuntime();
Process process = rt.exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes(command + "\n");
os.flush();
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (IOException e) {
return false;
} catch (InterruptedException e) {
return false;
}
return true;
}