I want to loop through all text files in a Hadoop dir and count all the occurrences of the word \"error\". Is there a way to do a hadoop fs -ls /users/ubuntu/ to li
hadoop fs -ls /users/ubuntu/
You can use a wildcard:
val errorCount = sc.textFile("hdfs://some-directory/*") .flatMap(_.split(" ")).filter(_ == "error").count