Explore Courses Blog Tutorials Interview Questions
+6 votes
in Big Data Hadoop & Spark by (1.5k points)

How can I find the size of a directory, using Hadoop?

2 Answers

+14 votes
by (13.2k points)

You can use the hadoop fs -ls command”.

This command displays the list of files in the current directory and all it’s details.In the output of this command, the 5th column displays the size of file in bytes.

For e.g.

command hadoop fs -ls     

input gives following output:

Found 1 items

-rw-r--r--   1 hduser supergroup  36789 2012-07-19 20:57 /user/hduser/input/shivangi

The size of file shivangi is 36789 bytes.

0 votes
by (33.1k points)

hadoop fs -du -s -h /path/to/dir

The above displays a directory's size in a readable form.

Do check out this tutorial video if you want to learn from scratch:

Browse Categories