If you want to delete all files from a folder, use the following function:
private void deleteTempFolder(String dir) { File myDir = new File(Environment.getExternalStorageDirectory() + "/"+dir); if (myDir.isDirectory()) { String[] children = myDir.list(); for (int i = 0; i < children.length; i++) { new File(myDir, children[i]).delete(); } } }
The folder must be present in storage. If not, we can check another coding for it.
if (myDir.exists() && myDir.isDirectory()) { //write same defination for it. }
Kailas Bhakade Nov 19 '16 at 20:11 2016-11-19 20:11
source share