From: Ronald Fischer Date: 2007-08-24T21:15:40+09:00 Subject: Re: How to append some data at the beginning of a file > 2. newfile.puts(File.read("test")) will read the entire file into > memory. Don't do this on large files - use the original way (or even > better, loop over the file with File#read(size)). For small files, > this read() is better. Good point! (Only that *prepending* data to a file which is so big that it would be a memory hog, is probably a nightmare anyway. > 3. newfile.puts(File.read("test")) will put an extra newline at the > end. Use either > newfile << File.read("test") > or > newfile.write(File.read("test")) Right, I overlooked this! Thanks for pointing this out. Ronald