note 60341 added to function.rename

From: Date: Wed, 04 Jan 2006 10:36:11 +0000
Subject: note 60341 added to function.rename
Groups: php.notes 
Request: Send a blank email to php-notes+get-101187@lists.php.net to get a copy of this message
rename() fails with PHP4 and PHP5 under Windows if the destination file exists, regardless of file permission settings. I now use a function similar to that of ddoyle [at] canadalawbook [dot] ca, which first tries rename(), checks if it returned FALSE and then uses copy()/unlink() if it failed. However, copy() is, unlike rename(), NOT useable for "atomic updates". Another process may actually access the destination file while copy() is working. In such a case, the other process with perceive the file as empty or with incomplete content ("half written"). ---- Manual Page -- http://www.php.net/manual/en/function.rename.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60341 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60341&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60341&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60341&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60341&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60341&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60341&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60341&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60341&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101187) next »