in reply to renaming subdirectories on MS Windows

You can get more information as to why the move failed by checking its RETURN value:
move( "$basedir/$olddir", "$basedir/$newname" ) or die $!;

Another piece of generic advice: use strict and warnings