File a file starting with certain string
require 'find' module Find def match(*paths) matched = [] find(*paths) { |path| matched << path if yield path } return matched end module_function :match end must_start_with = "This Ruby program" Find.match('./') do |p| if File.file? p open(p) { |f| f.read(must_start_with.size) == must_start_with } else false end end # => ["./rubyprog-0.1/README"]