title: File count in an HDFS directory
body: <p>In Java code, I want to connect to a directory in HDFS, learn the number of files in that directory, get their names and want to read them. I can already read the files but I couldn't figure out how to count files in a directory and get file names like an ordinary directory.</p>
  
  <p>In order to read I use DFSClient and open files into InputStream.</p>