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 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
11,088 questions
0 comments No comments
{count} votes

Your answer

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