From: Stuart Clarke Date: 2009-04-09T03:21:50+09:00 Subject: Re: Copying Windows system files I am thinking, its being caused me copying lots of files with the same name (index.dat) and only the last copied file is present in my destination folder, which is infact corrupt. How would I assign a new name to a file if one already exists, for example I am thinking if File.exist(Index.dat) File.copy(file[x], '\\Test') else File.copy(file, '\\Test') Basically I am trying to say, if you find an index.dat file in the destination folder copy the next index.dat file but give it a squential number index[1].dat index[2].dat Does that make sense? thanks a lot James Herdman wrote: > Hi Stuart. > > Two thoughts: > > 1) Maybe you don't have access to the file? > > 2) Instead of opening the file, reading it, and then copying it else > where, > why not look into using FileUtils.cp? It would be a little more direct. > It > also may end up being the key if you do, in fact, have access to the > file. > > James > > On Wed, Apr 8, 2009 at 10:15 AM, Stuart Clarke -- Posted via http://www.ruby-forum.com/.