tl;dr:
To be able to use wildcards (globs) in the listed paths, one simply has to use globStatus(...)
instead of listStatus(...)
.
Instead of listStatus you can try hadoops globStatus. Hadoop provides two FileSystem method for processing globs:
public FileStatus[] globStatus(Path pathPattern) throws IOException
public FileStatus[] globStatus(Path pathPattern, PathFilter filter) throws IOException
An optional PathFilter can be specified to restrict the matches further.
For more description you can check Hadoop:Definitive Guide here
Hope it helps..!!!