note 61370 deleted from function.rename by googleguy

From: Date: Tue, 22 Oct 2013 14:55:21 +0000
Subject: note 61370 deleted from function.rename by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197238@lists.php.net to get a copy of this message
Note Submitter: kitty_zoso at NOSPAMyahoo dot com ---- 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');

« previous php.notes (#197238) next »