note 59570 deleted from function.rename by cmb

From: Date: Sun, 22 Dec 2019 09:06:10 +0000
Subject: note 59570 deleted from function.rename by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213589@lists.php.net to get a copy of this message
Note Submitter: jmalinsky at gmail dot com ---- On WinXP/PHP 5+, not only does rename() not follow the *nix rename as noted below, but other things (do not) happen. If you're trying to rename a directory, files within the directory will NOT be present in the renamed directory, though sub-directories WILL be present. Ultra-strange. And as noted, your 'old' directory will remain on the server totally intact, which can be very confusing. To try and rename a folder on XP via PHP, I wound up using a workaround: first i used the copydirr() function posted by makarenkoa at ukrpost dot net on the "copy" page of the online manual to copy all folders and files within the original directory to the new one... and then to delete the original directory (and all files/folders beneath it), i used the delDir() function corrected by czambran at gmail dot com on the "rmdir" page of the online manual. Why didn't I use unlink()? Because, unlink does NOT work on Windows systems either (and even if it did work, its not recursive without extra coding). So, all in all, rename() is pretty much a useless function if you are intending to rename a folder on an XP box.

« previous php.notes (#213589) next »