I use this code, Not all my own, some from the php manual (probably most of it in fact) I lock the file as filename.lock so that I can muck about with it completely and then unlock the .lock and remove it. M function LockFile($file) { $LockFile = $file . ".lock"; # Lock the file $lf = fopen ($LockFile, "wx"); while ($lf === FALSE && $i++ < 20) { clearstatcache(); usleep(rand(5,85)); $lf = @fopen ($LockFile, 'x'); } if ($lf !== False) { return array ($lf,$LockFile); } else { return FALSE; } } ############################### # # UnLockFile() # function UnLockFile($LockArray) { list($lf, $LockFile) = $LockArray; fclose($lf); unlink($LockFile); } -----Original Message----- From: Michael Sims [mailto:michaels@xxxxxxxxxxxxxx] Sent: 17 December 2004 15:28 To: php-general Subject: RE: File Locking during *other* file operations Gerard Samuel wrote: > Im talking about file locking during deleting, and moving files. > Is it possible to perform file locking for these file operations? Yes, have your scripts attempt to lock a separate lock file before performing deleting or moving operations. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ________________________________________________________________________ This message has been checked for all known viruses by the CitC Virus Scanning Service powered by SkyLabs. For further information visit http://www.citc.it ___ ________________________________________________________________________ This message has been checked for all known viruses by the CitC Virus Scanning Service powered by SkyLabs. For further information visit http://www.citc.it ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php