Hi -- On Sat, 25 Oct 2008, luisbebop wrote: > I did a single line of code in Ruby, which joins all text files in a > folder to a bigfile. I got some tests, and it's works! > Does anyone knows a better way, or other 'Ruby Way' to do that ? > > File.open('bigfile','w') { |mergedFile| Dir.glob("*.txt").each { | > file| File.readlines(file).each { |line| mergedFile << line } } } You can use read rather than readlines, and save a loop: Dir["*.txt"].each {|f| merged_file.print(File.read(f)) } or similar. David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL * * Co-taught with Patrick Ewing! See http://www.rubypal.com for details and updates!