I solved the problem and thought I would post the solution just in case someone else encounters it. I don't understand why the original script doesn't work but here's the solution.
Originally, the script was trying to do this:
dirrename('c:\test\sub', 'c:\test\test')
I also tried this just in case:
dirrename('c:\test\sub\', 'c:\test\test\')
after changing to a different drive. So here's what worked.
dirchange('c:\test')
dirrename('sub', 'test)
I'd appreciate if someone could explain why the original code failed. I know that if you're moving a folder you shouldn't be logged to its drive. Obviously this doesn't apply to renaming a folder.
Thanks
George