Code: Select all
if (there is file tNewFilePath) then
-- skip this file
put "New name already exists, so skipping new name : " & tNewFileName & cr after tErrorsLog
add one to tErrorCount
next repeat
end if
After much head scratching I realised the issue was with the line "next repeat". This line is an orphan as I removed the original repeat loop and failed to notice the line. The error only occurred when the if statement was true which was a rare event and the reason why the rest of the code processed thousands of files before failing.
I think the IDE should post a syntax error and not allow the code to be applied much as it does with if statements with no end ifs - what do you think?
S