Unlink fails with "Permission denied" error
By gc on Aug 03, 2007
Today, I am stuck in debugging a simple perl script. The same script runs perfectly fine on Unix system, only fails on PC. The failure comes when executing unlink a version file with error "Can not remove file Permission denied at c:\\myScript.pl line 167...".
I checked the file permission, it is owned by administrator who has the full control of this file. Actually this file is copied by the script from somewhere. After googl'g for a while, I realize that the problem is not the access permission but the file is opened in the script but not closed.
This is the same problem as if I wish that perl can report a more meaningful error. I guess it is a problem of OS. Because if you open a word file, but try to delete it by using Windows Explorer, you get the same kind of error - permission denied. Yeh! it is Microsoft's fault!