(1) Maybe you do not have the Linux system user rights to delete that directory. On Android I'd assume you only have that permission if it's a directory of the same program that tries to delete it. Expressed in a different way: You can't delete directories from other applications.
(2) As the Java docs state: "If this pathname denotes a directory, then the directory must be empty in order to be deleted." So, no, you need to remove all files und subdirectories first before removing the directory. -- http://www.deepdroid.com On Jun 2, 12:30 pm, Gavin <fjm...@gmail.com> wrote: > Hello, > I have some questions. > (1) > I want to remove a directory on filesystem, it is successful but > some logs info was printed: unable to unlink "/data/data/packageName/ > dir1/dir2". there are no any file in dir2. > > my codes: > > File dir = getFileStreamPath("dir1"); > File subdir=new File(dir, "dir2"); > if(subdir.exists()) > { > subdir.delete(); > } > > (2) > If there are some files in dir2, can I remove the whole directory? > > thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---