HDFS: How do you list files recursively?

前端 未结 3 758
梦毁少年i
梦毁少年i 2021-02-12 11:26

How do you, through Java, list all files (recursively) under a certain path in HDFS. I went through the API and noticed FileSystem.listFiles(Path,boolean) but it looks like that

3条回答
  •  忘掉有多难
    2021-02-12 12:08

    You can look at the source for org.apache.hadoop.fs.FsShell.ls(FileStatus, FileSystem, boolean, boolean) for your version of hadoop - this is what is called when you perform a hadoop fs -lsr path from the command line

    • 0.20.2 - line 593
    • 1.0.2 - line 590

提交回复
热议问题