Re: Atomic file check/opening?
| From: | Jason Brooke | Date: | Wed, 05 Jul 2000 23:25:03 +0000 |
| Subject: | Re: Atomic file check/opening? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5097@lists.php.net to get a copy of this message | ||
When you checked the docs for fopen(), you'd have found the answer to the
first half of your question covered there
http://www.php.net/manual/function.fopen.php
flock will do the job for locking files, not sure about directories though -
you might give it a try and see what happens
jason
> 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
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>