note 61370 added to function.rename

From: Date: Wed, 01 Feb 2006 19:45:48 +0000
Subject: note 61370 added to function.rename
Groups: php.notes 
Request: Send a blank email to php-notes+get-102834@lists.php.net to get a copy of this message
Beware of rename if you're interested in preserving the case of filenames. I'm writing a backup application using the command line version of php 5 on Windows XP and wanted to detect when the case of a source dir entry changed so I could rename it on the backup drive. For instance, \common\kathy has been renamed to \common\Kathy on the source drive, so I wanted to rename the target directory, so a restore operation will have the new name to use. The rename function didn't return false, but didn't change the case of the entry! As a workaround (ugh) I change it to "something else" then do the final rename: instead of rename('kathy','Kathy'); I use rename('kathy', '~kathy~'); rename('~kathy~', 'Kathy'); ---- Server IP: 64.246.30.37 Probable Submitter: 4.40.64.164 ---- Manual Page -- http://www.php.net/manual/en/function.rename.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61370 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61370&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61370&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61370&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61370&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61370&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61370&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61370&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61370&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102834) next »