I have a folder which contains some files that I want to deleted after processing them. The files have the extension .FIR After some googling I found a recursive method that I modified a bit:
void delete(File f) throws IOException {
if (f.isDirectory()) {
for (File c : f.listFiles())
if(f.listFiles().toString().contains(".FIR"))
delete(c);
}
if (!f.delete())
throw new FileNotFoundException("Failed to delete file: " + f);
}
This function will throw an IOException telling me:
07-31 11:02:31.885: E/DELETE:(5694): Failed to delete file: /mnt/sdcard/ExtractedFiles
The folder has been set to RW operations. And in my manifest file:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I couldn’t find another permission that sounded something like MODIFY_FILES
Any ideas?
try this: