Number of subdirectories in a directory?
<p>How to find the number of subdirectories in a specified directory in HDFS?</p>

<hr>

<p>When I do <code>hadoop fs -ls /mydir/</code>, I get a Java heap space error, since the directory is too big, but what I am interested in is the number of subdirectories in that directory. I tried:</p>

<pre><code>gsamaras@gwta3000 ~]$ hadoop fs -find /mydir/ -maxdepth 1 -type d -print| wc -l
find: Unexpected argument: -maxdepth
0
</code></pre>

<p>I know that the directory is not empty, thus 0 is not correct:</p>

<pre><code>[gsamaras@gwta3000 ~]$ hadoop fs -du -s -h /mydir
737.5 G  /mydir
</code></pre>