I was wondering if there was a way to check if a file is in use before deleting it.
I ask because I have one script that locks a file before writing to it, but I have another script that deletes the file when it's been sitting on my server for too long.
If the script executing the file delete happens to run when the file is being rewritten then the unlinking will fail.
I thought about sticking the '@' operator in front of my unlink call then running it in a while loop until it's been deleted or has ran for more than a 1/2 second.