From: sdsd asda Date: 2013-05-06T05:47:50+09:00 Subject: Files management with Ruby Hi there I am trying to build a script that does the following. Say there are two directories A and B. In A, there is the file called "Today". In directory B there are the files called "Today1", "Today2", "otherFile". I want to loop through directory A, open the file called "Today" and append all the files in Directory B that have the word "Today" in their file name. So where I am at is, I am trying to write a method first to just loop through Directory A and just add some text to the file called "Today". This is not working below. Can anyone tell me where I am going wrong? Much appreciated def append_data_to_daily_files Dir.entries('A').each do |file| next if !(file.match(/today/)) File.open(file, 'w') {|file| file.write("hello") file.close} end end -- Posted via http://www.ruby-forum.com/.