什么可能是PHPs重命名()抛出错误/警告访问被拒绝(代码5)的问题

Ok, so Im trying to use rename(path to directory) and it seems pretty trivial even though I have read about alot of issues related to it. Whenever I try to rename a specific directory it works fine, but with another directory within the same directory, same file permissions etc, it produces a warning and rename() function is not successful. What are more reasons other than file permissions that produce such a warning ? I'm puzzled!

SOLVED! The issue was what I suspected! The only logical explanation for an Access denied warning was that the handle was still open! This was the case as I was using scandir(), I switched to the good old php4's equivalent solution.. opendir(); readdir(); AND closedir(); Those 3 steps are crucial when working with directories! If anyone knows of an equivalent to closdir() when using scandir(), please post a solution! Thanks and Regards