Atomic file check/opening?
| From: | Kris Kelley | Date: | Wed, 05 Jul 2000 23:16:57 +0000 |
| Subject: | Atomic file check/opening? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-5095@lists.php.net to get a copy of this message | ||
Is there a function in PHP 4 (I'm using 4.0.1, specifically) that checks or
the existence of a file, then creates it if it doesn't exist, all in one
"atomic" process? In C under Unix, I would use this:
fdes = open("path/to/file",O_WRONLY|O_CREAT|O_EXCL,0);
I need this to "lock" a directory, so that only one process at a time can
move files into or out of the directory. I have checked the documentation
for fopen and flock, but they don't seem to have what I am looking for.
Thanks for any help!
---Kris Kelley