note 56576 added to function.rename

From: Date: Wed, 07 Sep 2005 22:35:27 +0000
Subject: note 56576 added to function.rename
Groups: php.notes 
Request: Send a blank email to php-notes+get-94881@lists.php.net to get a copy of this message
rename() definitely does not follow the *nix rename convention on WinXP with PHP 5. If the $newname exists, it will return FALSE and $oldname and $newname will remain in their original state. You can do something like this instead: function rename_win($oldfile,$newfile) { if (!rename($oldfile,$newfile)) { if (copy ($oldfile,$newfile)) { unlink($oldfile); return TRUE; } return FALSE; } return TRUE; } ---- Manual Page -- http://www.php.net/manual/en/function.rename.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56576 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56576&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56576&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56576&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56576&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56576&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56576&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56576&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94881) next »