How to check whether the file is a directory or not?

How will you list different files and directories in a drive and also how will you check whether the listed one is a file or directory?Message was edited by: anjana_k
[187 byte] By [anjana_ka] at [2007-10-3 4:27:01]
# 1

You should do a [url http://en.wikipedia.org/wiki/Recursion_%28computer_science%29]recursive method[/url] using those:

[url http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#listRoots()]File.listRoots()[/url]

[url http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#listFiles()]File.listFiles()[/url]

[url http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#isDirectory()]File.isDirectory()[/url]

BTW this has nothing to do with generics.

Regards

jfbrierea at 2007-7-14 22:29:44 > top of Java-index,Core,Core APIs...