in reply to rename works sporadically on windows??

My guess is that the file is open. MP3::Tag has different handlers for ID3v1 and ID3v2 formats, so my guess is that some of the "unrenamable" files have ID3v2-style tags and are kept open. Permission denied usually means that a file has been opened by a program and not yet closed, even if it is your own program.

You can try to close the file by discarding your $mp3 variable before trying to rename. Update: See bart's post below for the ->close method, which is likely less confusing than the discarding of the object just to close the filenhandle.

... my ($title, $track, $artist); { my $mp3 = MP3::Tag->new($curfile) or die "Didn't get an mp3 tag from '$curfile'"; ($title, $track, $artist) = $mp3->autoinfo(); }; ...

As an aside, rename() also takes directory names, so you don't need to chdir(). Have a look at File::Basename and/or File::Spec to get convenient pathname manipulation tools:

my $newname = File::Spec->catfile($mp3dir[$i],"$track. $artist - +$title.mp3"); my $oldname = File::Spec->catfile($mp3dir[$i],$mp3file[$i]); rename($oldname, $newname) or die "Couldn't rename '$oldname' to '$newname': $!";