How To Make Deletes File & Folder Programmatically Java Android Studio
this is my proggramaticaly on g syntax so I can delete files. The 2nd function and function as well as this call is very efficient and makes it easy for you to modify and add other functions
you can use and try it
Function For deleteFiles :
public static void deleteFiles(String path) {
File file = new File(path);
if (file.exists()) {
String deleteCmd = "rm -r " + path;
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec(deleteCmd);
} catch (IOException e) {
}
}
}
Put in this Function again For Continue deleteFiles :
public void deleteuserengine(){
File targetGB = new File(copypasteuserengineGB + "/Config");
deleteFiles(copypasteuserengineGB + "/Config");
}
Call back deleteuserengine(); on your button or menu