How to print file tree with hadoop? How to print file tree with hadoop? hadoop hadoop

How to print file tree with hadoop?


Based on http://en.wikipedia.org/wiki/Tree_(Unix) you can come up with a tree like representation, e.g:

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


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


Technically, if you really want that (though I don't know why would you want to, except for debugging / visualization / entertainment purposes), you can mount HDFS as normal filesystem using fuse - there are a couple of implementations available. That would give you a directory that you can run your favorite "tree" visualizer or whatever you are used to with normal filesystems.