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@xxxxxxxxxxxxxxxxxxxxx
(replies-lists-b2z2-php@xxxxxxxxxxxxxxxxxxxxx) 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@xxxxxxxxxxxxxxx>
To: PHP eMail List <php-general@xxxxxxxxxxxxx>
Subject: 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 ----------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php