in reply to Can't rename all directories but only some

I second that you should check permissions (especially important if this is a stealth CGI question, because the web server runs as an anonymous user with greatly restricted rights).

Another hugely important point is the way you handle filenames:

Do not, I repeat NOT use backslashes (\) as the directory separators with Perl under Windows. Use normal forward slashes (/) unless you really want to get anal about replacing each and every occurence of backslash (\) with double backslash (\\) each and every time.

When you perform a system function on a file, such as rename, you should always return, not only the error ($!), but also the filename itself, like so:

rename $old,$new or die "Cannot rename $old to $new:$!\n";

This is because the most frequent cause of error in such cases is a malformed filename.

For example if you tried to rename your file: C:\elmPaul\jod25573786-2k2 and returned the name, you would find that you were actually trying to rename the file:
C:
backslash e = ESC
elmpaul
backslash j = no special meaning
jod25573786-2k2

which probably does not exist.

Regards,

Helgi Briem