Share via

File deletion delay

Wim Roffel 0 Reputation points
2024-03-11T11:30:16.89+00:00

For a software project in which I participate the installation routine contains the following code (PHP):

unlink(getcwd() . '/index.php');

unlink(getcwd() . '/prestashop.zip');

rename(getcwd() . '/index.php.temp', getcwd() . '/index.php');

It results in an "access denied" error for the last line.

This is a Windows specific error. Somehow the file of the first line (that is also the executing code that contains this line) is not yet deleted when the third line is executed and as a result the third line is refused.

I would like to know how I can work around this problem.

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.