Re: Rename

From: Date: Thu, 24 Jan 2008 21:18:14 +0000
Subject: Re: Rename
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-268038@lists.php.net to get a copy of this message
First get an array of all the files, e.g., $fpDir is the full path to yiour dir. foreach(glob("$fpDir*.*") as $file)
    {
        $filesArray[] = $file;
    }
print_r($filesArray); //so you can see what's happening Then do a: foreach($filesArray as $file){ rename($sourceDir.$file, $destDir. $file); } This is just an outline. All the paths should be full. Once you get this working, you can put the rename() in the first foreach() loop. Don't forget to take care of exceptions. Pastor Steve wrote:
I have been looking, but the problem is that I don¹t know what questions to ask or what to look for. I think it is a rename function. That works, but it only does one file at a time. I was looking for something that will do all the files in the directory without needing to know the name of each file. I couldn¹t find anything like that there. Thanks, -- Steve M. on 1/24/08 2:46 PM replies-lists-b2z2-php@listmail.innovate.net (replies-lists-b2z2-php@listmail.innovate.net) wrote:
i believe you will find what you're looking for by searching or browsing the documentation found at: <http://www.php.net/manual/en/> - Rick ------------ Original Message ------------
Date: Thursday, January 24, 2008 02:36:55 PM -0600 From: Pastor Steve <smarquez@ccfortsmith.com> To: PHP eMail List <php-general@lists.php.net> Subject: [PHP] Rename Does anyone know if there is a way to move all the files in one directory into another? Thanks, -- Steve M.
---------- End Original Message ----------


« previous php.general (#268038) next »