Unlink fails with "Permission denied" error
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!
Posted at 06:59PM Aug 03, 2007 by gc in Personal | Comments[1]
Amazing, thank you for this awesome tip. We were pulling out our hair for a while there but it turned out to be just as you described!
Posted by Mark on March 26, 2009 at 01:55 PM PDT #