From: Brian Candler Date: 2008-10-25T20:56:51+09:00 Subject: Re: Join all text files in a folder, with a single line of Ruby code 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 } } } system("cat *.txt >bigfile") :-? -- Posted via http://www.ruby-forum.com/.