thx the loop stops but now i have this problem

if in c:\temp i have a file called test.doc
and in c:\test i have 3 files called
test.doc
test1.doc
test2.doc

as far as i read the script it should check test.doc is there if so rename to test1.doc check if that is there etc etc

but it doesn't, after the loop i have the copy command and it fires off as soon as it's renamed the file once and trys to overwrite the file

any ideas?