From: hemant Date: 2006-12-15T18:00:56+09:00 Subject: Re: Swap contents in two files On 12/14/06, Christopher Latif wrote: > Christopher Latif wrote: > > Hemant Kumar wrote: > >> On 12/14/06, Christopher Latif wrote: > >>> How the code for that program going to look like? > >>> > >> > >> How abt: > >> require 'fileutils' > >> > >> FileUtils.copy_file("a.exe","b.exe") > >> FileUtils.mv "a.exe.stackdump","a.exe" > >> FileUtils.mv "b.exe","a.exe.stackdump" > > > > > what's stackdump? > Heh.. don't worry abt stackdump its the stackdump file of of a.exe, with whom I am going to swap the content. b.exe was the temporary file. I would suggest go for Ara's solution, I jumped the gun a tad too quickly. but, before running mine script, please put your actual file names... in stead of dummy one that I have put for you. Obviously, in your current directory those files are not there and hence the error: require 'fileutils' FileUtils.copy_file("src_file","temp_file") FileUtils.mv "dest_file","src_file" FileUtils.mv "temp_file","dest_file" but if you are planning to use, above code, you will have to make sure that your program doesn't have another temp_file open with same name. -- gnufied ----------- There was only one Road; that it was like a great river: its springs were at every doorstep, and every path was its tributary.