HDFS - List Folder Recursively

This code snippet provides one example to list all the folders and files recursively under one HDFS path. The key is to use `-R` option of the `ls `sub command. Sample output: ![2022082465735-image.png](/api/flex/medias/obj-2747 "2022082465735-image.png")

Kontext Kontext 0 526 0.51 index 8/24/2022

Code description

This code snippet provides one example to list all the folders and files recursively under one HDFS path. The key is to use -R option of the ls sub command.

Sample output:

2022082465735-image.png

Code snippet

    # Replace the path accordingly to your HDFS path
    hadoop fs -ls -R /user/hive/warehouse/test_db.db/bucket_table
hdfs shell

Join the Discussion

View or add your thoughts below

Comments