使用hadoop命令显示子目录

时间:2018-07-23 14:31:00

标签: shell unix hadoop

我有hadoop目录格式,例如

Main_Path/Category/Year/Month/Day/Hours=00/Part-0000
Main_Path/Category/Year/Month/Day/Hours=01/Part-0001
Main_Path/Category/Year/Month/Day/Hours=02/Part-0002
Main_Path/Category/Year/Month/Day/Hours=03/Part-0003

我想获得如下格式的输出

        Main_Path/Category/Year/Month/Day/Hours=00
        Main_Path/Category/Year/Month/Day/Hours=01
        Main_Path/Category/Year/Month/Day/Hours=02
        Main_Path/Category/Year/Month/Day/Hours=03

我尝试了以下命令

hadoop fs -ls -C Main_Path

o / p:-

Main_Path/Category/Year/Month/

但是只得到两个子目录

我的预期输出如下

            Main_Path/Category/Year/Month/Day/Hours=00
            Main_Path/Category/Year/Month/Day/Hours=01
            Main_Path/Category/Year/Month/Day/Hours=02
            Main_Path/Category/Year/Month/Day/Hours=03

1 个答案:

答案 0 :(得分:0)

您可以尝试以下命令:

hadoop fs -ls -R / | grep“ ^ d”

因此,没有hadoop命令可以停止目录。