How can i delete file from /mnt/sdcard/ through Native Code ? permission of sdcard in android "d---rwxr-x system sdcard_rw 2013-01-29 14:39 sdcard"
permission of file in android " ----rwxr-x "
Join Stack Overflow to learn, share knowledge, and build your career.
How can i delete file from /mnt/sdcard/ through Native Code ? permission of sdcard in android "d---rwxr-x system sdcard_rw 2013-01-29 14:39 sdcard"
permission of file in android " ----rwxr-x "
You need to delete the file by using the delete()
method in File
File file = new File(pathToFile);
boolean deleted = file.delete();
pathToFile is the path of the file in SDCARD.
you mean delete file using adb command
adb shell rm /sdcard/yourpath/file
from android application you can use
String deleteCmd = "rm " + "/sdcard/yourpath/file";
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec(deleteCmd);
} catch (IOException e) {
if (log != null)
log.error("IO Exception deleteFiles" + e);
}
use execl to run above command using c