Skip to content

Instantly share code, notes, and snippets.

@oem
Created October 25, 2010 11:17
Show Gist options
  • Save oem/644801 to your computer and use it in GitHub Desktop.
Save oem/644801 to your computer and use it in GitHub Desktop.
print the folder structure recursively from the current folder
def read_dir(current, indent="")
Dir[current + "/*"].each do |dir|
puts indent + dir.to_s.scan(/[^\/]+$/).to_s
read_dir(dir, indent + " ") if FileTest.directory?(dir)
end
end
read_dir(".")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment