Mei Jones wrote:Thanks for the reply..
All what I need by checking exists on File object whether the last sub folder is empty or not.
/A/B/C .. if C is the last folder want to know whether C is empty or not. I thought f.exists() will do the trick apparently not..
If your File object corresponds to /A/B/C, then exists() will tell you whether /A/B/C exists. This is stated in the documentation.
If you want to know if C is empty, then you need to to call isDirectory(), and if it's true, call list() or listFiles() and see if it returns an empty array. This is also evident from the documentation.