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 "tree" in any *nix system, and give us a result like that:
[admin~]$tree
.
├── backup_snapshot.sh
├── project
│ ├── doc
│ │ └── README
│ ├── src
....
that is very clearly output, but since the HDFS is not fully POSIX compliant, so I'm not sure how to print that in 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/-/|/'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With