How to recursively list files and directories in HDFS? - Big Data In Real World

How to recursively list files and directories in HDFS?

Different ways to insert data into Hive table
March 31, 2021
How to send large messages in Kafka?
April 5, 2021
Different ways to insert data into Hive table
March 31, 2021
How to send large messages in Kafka?
April 5, 2021

Common problem with a pretty simple solution.

Solution

When you are doing the directory listing use the -R option to recursively list the directories. If you are using older versions of Hadoop, hadoop fs -ls -R / path should work.

[hirw@wk1 ~]$ hdfs dfs -ls -R /

drwxrwxrwx   - yarn   hadoop          0 2020-11-10 16:26 /app-logs
drwxrwx---   - hdfs   hadoop          0 2020-11-10 16:26 /app-logs/hdfs
inode="/app-logs/hdfs":hdfs:hadoop:drwxrwx---
drwxr-xr-x   - hdfs   hdfs            0 2020-08-01 13:46 /apps
drwxr-xr-x   - hdfs     hdfs            0 2020-08-01 13:36 /apps/hive
drwxrwxrwx   - hive     hadoop          0 2020-11-10 17:34 /apps/hive/warehouse
drwxrwxrwx   - hirw     hadoop          0 2020-11-10 17:34 /apps/hive/warehouse/hirw.db
drwxrwxrwx   - hirw     hadoop          0 2020-11-10 17:34 /apps/hive/warehouse/hirw_2.db
drwxrwxrwx   - hirw     hadoop          0 2020-11-10 16:59 /apps/hive/warehouse/hirw_2.db/employee
drwxr-xr-x   - zeppelin hdfs            0 2020-08-01 13:46 /apps/zeppelin
-r--r--r--   3 zeppelin zeppelin  212622217 2020-08-01 13:46 /apps/zeppelin/zeppelin-spark-dep
Big Data In Real World
Big Data In Real World
We are a group of Big Data engineers who are passionate about Big Data and related Big Data technologies. We have designed, developed, deployed and maintained Big Data applications ranging from batch to real time streaming big data platforms. We have seen a wide range of real world big data problems, implemented some innovative and complex (or simple, depending on how you look at it) solutions.

Comments are closed.

How to recursively list files and directories in HDFS?
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.

Hadoop In Real World is now Big Data In Real World!

X