File system crawler - iteration bugs
问题 I'm currently building a file system crawler with the following code: require 'find' require 'spreadsheet' Spreadsheet.client_encoding = 'UTF-8' count = 0 Find.find('/Users/Anconia/crawler/') do |file| if file =~ /\b.xls$/ # check if filename ends in desired format contents = Spreadsheet.open(file).worksheets contents.each do |row| if row =~ /regex/ puts file count += 1 end end end end puts "#{count} files were found" And am receiving the following output: 0 files were found The regex is