|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-08 13:52 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 12:00:01 2025 UTC |
Description: ------------ When I use function rename() to rename a folder by recursion. But it doesn't work as usual.It renamed the file twice. Reproduce code: --------------- function addDomain($directory) { if (is_dir($directory)) { $dirHandle = opendir($directory); while ($file = readdir($dirHandle)) { if ($file != '.' && $file != '..') { if (is_dir($file)) { //do nothing; } else { rename($directory.$file,$directory.$file.'r'); echo $directory.$file.'<br>'; } } } closedir($dirHandle); } } addDomain("test/"); Expected result: ---------------- test/Q4.php<br>test/Q5.php<br> Actual result: -------------- test/Q4.php<br>test/Q5.php<br>test/Q4.phpr<br>test/Q5.phpr<br>