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!

Comments:

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 06:55 AM PDT #

yeah, you are right! thank you for the tip!

Posted by guest on October 12, 2010 at 04:57 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

gc

Search

Categories
Archives
« May 2015
SunMonTueWedThuFriSat
     
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
      
Today