Thursday, 25 February 2016

Deleting files from a folder - android

Very simple delete the file from folder for particular format

File dir = new File(Environment.getExternalStorageDirectory() + "/Pictures/.Twogether/Videos");
        if (dir.isDirectory()) {
            String[] children = dir.list();
            for (int i = 0; i < children.length; i++) {
                if (new File(dir, children[i]).getAbsolutePath().endsWith("3gp2")) {
                    new File(dir, children[i]).delete();
                }
            }
        }

No comments:

Post a Comment