I trying to delete the folder and the files inside the folder, if i execute the command (rmdir /s /q folderpath) it works fine, but when u run the below code, it's unable to delete the file, can you please help me where I am doing wrong?
String folderPath = "C:\\Users\\"+userName+"\\Documents\\test\\";
void deleteDir()
{
int flag;
File f = new File(folderPath);
try
{
Runtime.getRuntime().exec("adb kill-server");
Runtime.getRuntime().exec("cmd /c rmdir /s /q "+f);
}
catch(Exception e) {e.printStackTrace();
}