From: John Locke Date: 2008-05-13T00:16:37+09:00 Subject: Cover a directory and put all the stuff in a TreeView Hi, I would like to make the following script in ruby: Given a directory, for example /home, I would like to take ALL the subdirectories and files that are inside /home, and put them in a TreeView structure (from Ruby GTK), so I would have all those subdirectories and files arranged in that structure that I could then display as a graphic object. I have found how to print all the stuff that is inside my current directory: require 'find' Find.find('./') do |f| p f end I could insert all what that command prints in the TreeView but then it would be all at the first level of the TreeView. So I need to know, at each loop, what is at what level (which is the father, which is the son, etc), in order to insert it correctly in the TreeView. In other words, right now I am able to do this: /home/a /home/a1 /home/a2 /home/b etc And I would like to do this: /home/a /home/a1 /home/a2 /home/b Any ideas? Thanks. -- Posted via http://www.ruby-forum.com/.