in reply to renaming subdirectories on MS Windows
move( "$basedir/$olddir", "$basedir/$newname" ) or die $!; [download]
Another piece of generic advice: use strict and warnings