How to print a file tree using hadoop?

I'm a new bird in HDFS and * nix, and I'm just curious how to print a file tree in hadoop?

for example, we can type a "tree" on any * nix system and give us this result:

[admin~]$tree
.
├── backup_snapshot.sh
├── project
│   ├── doc
│   │   └── README
│   ├── src
....

which is very clearly displayed, but since HDFS is not fully compatible with POSIX, so I'm not sure how to print this in hadoop.

+5
source share
3 answers

Based on http://en.wikipedia.org/wiki/Tree_(Unix) you can find a tree type representation, for example:

hadoop fs -lsr /mydir | awk '{print $8}' | \
sed -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
+12
source

Just created a simple project that does just that: http://github.com/trovit/hdfstree

+2
source

Technically, if you really want it (although I don’t know why you need it, except for debugging / visualization / entertainment tasks), you can mount HDFS as a regular file system using a fuse - there are several implementations available. This will give you a directory in which you can run your favorite tree visualizer, or how you are used to regular file systems.

0
source

All Articles