Wildcard in Hadoop's FileSystem listing API calls

后端 未结 1 1658
陌清茗
陌清茗 2021-02-07 07:39

tl;dr: To be able to use wildcards (globs) in the listed paths, one simply has to use globStatus(...) instead of listStatus(...).


1条回答
  •  借酒劲吻你
    2021-02-07 07:52

    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..!!!

    0 讨论(0)
提交回复
热议问题