ListFiles from HDFS Cluster
You can indeed use getPath()
this will return you a Path
object which let you query the name of the file.
Path p = ritr.next().getPath();// returns the filename or directory name if directoryString name = p.getName();
The FileStatus
object you get can tell you if this is a file or directory.
Here is more API documentation:
http://hadoop.apache.org/common/docs/r1.0.0/api/org/apache/hadoop/fs/Path.html
http://hadoop.apache.org/common/docs/r1.0.0/api/org/apache/hadoop/fs/FileStatus.html