note 64320 added to function.rename

From: Date: Wed, 12 Apr 2006 10:32:22 +0000
Subject: note 64320 added to function.rename
Groups: php.notes 
Request: Send a blank email to php-notes+get-107850@lists.php.net to get a copy of this message
Can anyone help? I am new to php. I am trying to rename a sub-dir folder from an html page using php so I can access a file within the sub-dir folder via hyperlink. The script has to work from a desktop location. This is the script I have tried but it doesn't seem to work. <?php // Assumes the directory in which this script exists has a single dub-directory // This script will rename it to $newDirName $newDirName = "mychosenname_for_hyperlink"; // The rest just renames the 1 dir to $newDirName if ($handle = opendir ('.')) { while (false !== ($file = readdir($handle))) { if ( $file != "." && $file != "..") { // See if a directory: if ( is_dir( $file)) { #rename it rename($file,$newDirName); } } } closedir($handle); } ?> Any suggestions would be great? ---- Server IP: 85.116.0.130 Probable Submitter: 80.3.32.10 (proxied: 82.0.37.132) ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.rename.php Edit -- http://master.php.net/note/edit/64320 Del: integrated -- http://master.php.net/note/delete/64320/integrated Del: useless -- http://master.php.net/note/delete/64320/useless Del: bad code -- http://master.php.net/note/delete/64320/bad+code Del: spam -- http://master.php.net/note/delete/64320/spam Del: non-english -- http://master.php.net/note/delete/64320/non-english Del: in docs -- http://master.php.net/note/delete/64320/in+docs Del: other reasons-- http://master.php.net/note/delete/64320 Reject -- http://master.php.net/note/reject/64320 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107850) next »