title: How to list the path of files inside Hdfs directory and subdirectory?
body: <p>Could not figure out a way to list all files in directory and subdirectories.</p>
  
  <p>Here is the code that I'm using which lists files in a specific directory but files if there is a subdorectory inside:</p>
  
  <pre><code>val conf = new Configuration()
  val fs = FileSystem.get(new java.net.URI("hdfs://servername/"), conf)
  val status = fs.listStatus(new Path("path/to/folder/"))
  status.foreach { x =&gt; println(x.getPath.toString()) }
  </code></pre>
  
  <p>the above code lists all the files inside the directory but I need it to be recursive.</p>