I am using `org.apache.hadoop.fs` to check if the directory in HDFS is empty or not. I looked up the FileSystem api but I couldn't find anything close to it. Basically I want to check if directory is empty or how many files exists in it. 

I was able to find "exists" method but this only tells whether the path exists or not.

```
val hdfs = FileSystem.get(spark.sparkContext.hadoopConfiguration)
val containsFile = fs.exists(new Path(dataPath))

```