From: Stuart Clarke Date: 2009-05-21T21:01:56+09:00 Subject: Re: Copying files and renaming dupes I have stepped back from this code for a while and I am still stuck. My thinking is 1. read source data set 2. if item in source matches criteria 3. move that file to target if a file with that name doesnt already exist in target 4. if a file does exist with the same name in target rename the file with a sequential number eg test[1].txt 5. then move the file to target This is the relevant code I have Find.find(dir) do |path| if File.extname(path) == ".txt" sourceFile.push File.basename(path) sourceFile.each do |source| if File.file?(path) and File.basename(path) != source File.move(path, culled) elsif File.move(path, temp) File.rename(tmp, "tester.exe") File.move(temp, target) end end end end This just doesn't do anything, not even error. Thanks in advance. Robert Klemme wrote: > On 17.04.2009 09:16, Stuart Clarke wrote: >> Ok I must of misunderstood the docs for it, in reflection I am thinking >> file.exist? >> >> Also, Robert what do you mean by creating a target name? > > You copy from source to target. > > robert -- Posted via http://www.ruby-forum.com/.