hadoop-hdfs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shahab Yunus <shahab.yu...@gmail.com>
Subject Re: Get the tree structure of a HDFS dir, similar to dir/files
Date Tue, 23 Jul 2013 20:53:21 GMT
See this



Basically you can write your own function, possible with recursion, to
iterate over a directory using the idea and combinations from above two


On Tue, Jul 23, 2013 at 2:05 PM, Huy Pham <phamvh@yahoo-inc.com> wrote:

>  Hi All,
>    Do any of you have or can refer me to some sample Java code that get
> the tree structure of a HDFS directory, similar to the file system?
>    For example: I have a HDFS dir, called /data, inside data, there is
> /data/valid and /data/invalid, and so on, so I would need to be able to get
> the whole tree structure of that and know which is is a dir, which one is a
> file. Both program and HDFS are LOCAL.
>    In other words, what I look for is something similar to File class in
> Java, which has isDirectory() and list() to list all the children (files
> and dirs) of a dir. Found something in stackoverflow but it does not work.
> Thanks
> Huy

View raw message