Android: How do you delete a folder starts with period

Posted by jclova on Stack Overflow See other posts from Stack Overflow or by jclova
Published on 2011-01-06T17:18:11Z Indexed on 2011/01/06 17:53 UTC
Read the original article Hit count: 235

Filed under:
|

I am trying to delete a folder in sdcard. I can delete normal directories, but a directory that starts with period cannot be deleted. (ex. ".helloDir")

    if (dir.isDirectory()) {
        String[] children = dir.list();
        for (int i = 0; i < children.length; i++) {
            new File(dir, children[i]).delete();
        }
    }

children is null if dir starts with period (ex. ".helloDir").

© Stack Overflow or respective owner

Related posts about android

Related posts about file-io