--00235433362e37dc6504b5625bf3 Content-Type: text/plain; charset=UTF-8 On Sat, Dec 31, 2011 at 7:42 AM, Alex Sweps <alexszepes / gmail.com> wrote: > Thanks you Gary it works now. HOWEVER one last thing I cannot get > working. When i run the file from the windows command prompt: > "c:/windows/ruby file.rb file" > it works perfect but i have a batch file that puts the file into the > script and it gives the error Permission Denied Errno::EACCES. I suspect > this is due to the file not being closed when it tries to rename it. The > .close methods produce the error undefinded method 'close' for Array. > If you still think this may be the case (of the file not being closed properly before rename), what happens when you run my example code exactly: File.open("original") do |f| puts f.readline end # this automatically closes the file (because a block is used) File.rename("original", "new_name") File.open("new_name") do |f| puts f.readline end Sorry, I could not test this on Windows myself, but I assume it should work ? Peter -- Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com --00235433362e37dc6504b5625bf3--