From: Erik Hollensbe Date: 2008-08-26T07:28:33+09:00 Subject: Re: Open file, get first line, delete first line close file Richard Schneeman wrote: > i this is the code that i've already uploaded, and is currently > running... If the file is exceptionally large, you can save a lot of memory (and processing time, likely), by doing something like this: File.open("my_file") do |f| f.readline File.open("my_file.tmp", 'w') do |f2| f2 << f.read end end FileUtils.mv("my_file.tmp", "my_file") The point here is that almost all the work is done on the file descriptors instead of in memory. I don't know if ruby has a sendfile() implementation, but that would be the most ideal, as it'd instruct the OS to do the copy. -- Posted via http://www.ruby-forum.com/.