From: Mmcolli00 Mom Date: 2009-01-28T03:46:06+09:00 Subject: read a ruby script like you would read a text file Do you know if this is possible: I want to read each ruby script in a directory (btw there a hundreds of them) and then use that info to lable and make reports later. For now, I just want to know if there is a possiblity to do this. Each script contains an intialized setting that I can use to distinguish the difference in my file standards. Later, I am going to create a report based on what is available. Any suggestions for the below code? Thanks, MC Dir.entries("C:/ScriptDirectory").each do |filename| if File.extname(filename) == ".rb" then #read a ruby file File.open(filename, 'r') do |f1| f1.each_line |line| @fileStandard1 << filename if line =~ /setting343234/ puts "Stardard1" +@fileStandard1 @fileStandard2 << filename if line =~ /setting343999/ puts "Standard2" +@fileStandard2 @fileStandard3 << filename if line =~ /setting343245/ puts "Standard3" +@fileStandard3 end end end ##this code is a snippet I am going to use the new variables later in the program. -- Posted via http://www.ruby-forum.com/.