title: Spark - Folder with same name as text file automatically created after RDD?
body: <p>I placed a text file named Linecount2.txt in hdfs and built a simple rdd to count the number of lines using spark.</p>
  
  <pre><code>val lines = sc.textFile("user/root/hdpcd/Linecount2.txt")
  lines.count()
  </code></pre>
  
  <p>This works.</p>
  
  <p>But when I tried using the same text file with the aforementioned path, I receive the error:</p>
  
  <pre><code> "org.apache.hadoop.mapred.InvalidInputException: Input path does not exist:"
  </code></pre>
  
  <p>When I looked into that path, I could see a folder was created 'Linecount.txt'.Hence the path for the file is now </p>
  
  <pre><code>("user/root/hdpcd/Linecount2.txt/Linecount2.txt") 
  </code></pre>
  
  <p>Then, after defining the path I was able to run it successfully.</p>
  
  <p>The third time I tried this, I got the same error because input path doesn't exist.</p>
  
  <p>When I went through the path,</p>
  
  <p><img src="https://i.stack.imgur.com/GOEOs.png" alt="enter image description here"></p>
  
  <p>Why does this happen?</p>