note 64320 rejected from function.rename by bjori

From: Date: Wed, 12 Apr 2006 10:34:01 +0000
Subject: note 64320 rejected from function.rename by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-107851@lists.php.net to get a copy of this message
Note Submitter: dekruz at aol dot com ---- 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?

« previous php.notes (#107851) next »