title: Get list of files from hdfs (hadoop) directory using python script
body: <p>How to get a list of files from hdfs (hadoop) directory using python script?</p>
  
  <p>I have tried with following line:</p>
  
  <blockquote>
    <p>dir = sc.textFile("hdfs://127.0.0.1:1900/directory").collect()</p>
  </blockquote>
  
  <p>The directory have list of files "file1,file2,file3....fileN". By using the line i got all the content list only.
  But i need to get list of file names. </p>
  
  <p>Can anyone please help me to find out this problem?</p>
  
  <p>Thanks in advance.</p>