Ok, Thanks for the suggestions. It turns out that I have a permissions/access problem, but I don't see how since I'm running as administrator!! I ran "system("whoami") and it returned Ed who is "administrator".
I also did an unlink call to remove the file first and $^E (thanks for the tip!) reported that the file was in use by another process. A good clue, but I can't tell what else is using it. It's not open in an editor or anything. Do I need to wait after I close it before doing the copy? NOTE I'm running this as a CGI script so I guess the script is running on the server as the person I logged in as. (the web app has a login) I changed the code per the suggestions: $a = stat($tmpfilename); $b = stat($rightslistfilename); printf "perms: %04o\n<br>", $a & 07777; printf "perms: %04o\n<br>", $b & 07777; if ( ! unlink( $rightslistfilename )) { print "Unlink ERROR!<br>"; print "$tmpfilename<br>"; print "$rightslistfilename<br>"; print "$!<br>"; print "$^E<br>"; } if( ! rename $tmpfilename, $rightslistfilename ) { print "Rename ERROR!<br>"; print "$tmpfilename<br>"; print "$rightslistfilename<br>"; print "$!<br>"; print "$^E<br>"; system("whoami"); } Which yeilded: Unlink ERROR! c:/cqms/DocLib/doc_repository/scripts/rightsList.txt.tmp c:/cqms/DocLib/doc_repository/scripts/rightsList.txt Permission denied The process cannot access the file because it is being used by another process Rename ERROR! c:/cqms/DocLib/doc_repository/scripts/rightsList.txt.tmp c:/cqms/DocLib/doc_repository/scripts/rightsList.txt Permission denied Access is denied Ed Thanks, Ed I took the section of code and ran it from the command line and it works fine, so it must be something having to do with it being run by the server? Thanks, Ed -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>