PHP Rename Permission Denied - Error Handlng
Posted on 2007-08-12
My website maintains a database along with a set of folders on my server. The Syncronization between these is working fine. By this I mean if you add a record to the table a folder is created with the same name, if you rename the record the folder is renamed to the new name etc etc.
The problem i am having is that becuase we run a Windows 2003 server and remote desktop onto it to do various other file management tasks to the contents within these folders created by the website you can provoke a Permission Denied error on the website by accidently having a file open within a folder that PHP wishes to rename!
I understand that this is what should happen as the results are the same within Windows but instead of my website just keeling over with an error message i would like to pop up a message saying "Folder in use : rename not possible, try again later...." or something along those lines?
I have tried :
if (!rename($old_folder, $new_folder)) .....
But this does not work...
Is there another way around this?