in reply to Re^2: Server access denied when checking for files
in thread Server access denied when checking for files

You don't check every operation for success. You should check that readdir worked:
@thefiles= readdir(IMD) or die "can't readdir: $!";
And the most important part : check that you can actually "move" the files:
system qq(move /y "$defaultdir/$text" "$destinationdir") or die "can't + move the file: $!";
to understand where exactly the script fails.