On 21.05.2009 14:01, Stuart Clarke wrote: > 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| This looks strange: you push to "sourceFile" and then iterate "sourceFile" but never remove anything from "sourceFile". > 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. The code looks a bit weird to me but one thing is certain: there is a lot of code missing (what is "culled"? how is "sourceFile" initialized etc.). It is hard to give any recommendations that way. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/