def parse_files(str)
      listing = str.each_line.inject({}) do |files, line|
        line.strip!
        name = line[/.*(?=\b\s+[ABDHNRS]+\s+\d+)/]
        name ||= line[/^\.\.|^\./]

        if name
          line.sub!(name, '')
          line.strip!

          type = line[0] == "D" ? :directory : :file
          size = line[/\d+/]

          date = line[/(?<=\d  )\D.*$/]
          modified = (Time.parse(date) rescue "!!#{date}")

          files[name] = {
            type: type,
            size: size,
            modified: modified
          }
        end
        files
      end
      Hash[listing.sort]
    end
def parse_files(str)
      listing = str.each_line.inject({}) do |files, line|
        line.strip!
        name = line[/.*(?=\b\s+[ABDHNRS]+\s+\d+)/]
        name ||= line[/^\.\.|^\./]

        if name
          line.sub!(name, '')
          line.strip!

          type = line[0] == "D" ? :directory : :file
          size = line[/\d+/]

          date = line[/(?<=\d  )\D.*$/]
          modified = (Time.parse(date) rescue "!!#{date}")

          files[name] = {
            type: type,
            size: size,
            modified: modified
          }
        end
        files
      end
      Hash[listing.sort]
    end
Parse output from Client#ls
 Returns Hash of file names with meta information