title: How can I create a file/directory tree from Net-SFTP results?
body: <p>I'm trying to create a tree of files and directories using the net-sftp library. </p>
  
  <p>I can get a recursive listing of files by using the .glob method and can determine if one of the results is a directory by using the .opendir method. </p>
  
  <p>I've been able to create a hash that has files and another hash that has directories, but I'd like to be able to create a tree. </p>
  
  <pre><code> files = []
   directories = []
  
   sftp.dir.glob("/home/**/**") do |entry|
        fullpath = "/home/" + entry.name
        file = Hash.new
        file[:path] = fullpath
  
          sftp.opendir(fullpath) do |response|
            unless response.ok?
              files.push(file)
            else
              directories.push(file)         
            end
          end
  
      else
      end
  
    end
  </code></pre>
  
  <p>Is creating such a tree possible from the results that net-sftp returns? </p>