I have a directory with files that look like abc_00_00.csv , abc_001_00.csv , abc_002_00.csv, def_00_00.csv
I want only those file which matched user input, i am trying below method but it is not working in spark
new File("dbfs:/s3path").listFiles.filter(_.getName.startsWith("abc_*")).foreach(println)
error
java.lang.NullPointerException
is there any way in spark through which i can iterate over match file in foor loop ?