From: Robert Klemme Date: 2008-10-25T23:40:45+09:00 Subject: Re: Join all text files in a folder, with a single line of Ruby code On 25.10.2008 13:56, Brian Candler wrote: > 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") Why not directly invoke "cat" from the shell prompt? :-) Kind regards robert