Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b36a7cbd78
Fetching contributors…

Cannot retrieve contributors at this time

executable file 27 lines (20 sloc) 0.524 kb
#!/usr/bin/env jruby
require 'swineherd'
#
# Creates a 'tree' view of an hdfs path. It's not as pretty as the
# unix tree command but that's only because I'm not smart enough to
# print the hierarchy properly.
#
FS = Swineherd::FileSystem.get(:hdfs)
path = ARGV[0]
# Recursively list paths
def lr path
paths = FS.entries(path)
if (paths && !paths.empty?)
paths.map{|e| {File.basename(path) => lr(e)}}.flatten
else
File.basename(path)
end
end
tree = {File.dirname(path) => lr(path)}.to_yaml
puts tree
Jump to Line
Something went wrong with that request. Please try again.