Link to home
Start Free TrialLog in
Avatar of Cybervanes
Cybervanes

asked on

php move all files from one folder to another

hello again...

i'm needing to add all contents from one folder to another using php. then delete the source.
source folder holds over 6,000 files..

does anybody have any ideas?

Ive tried the following with no luck..


<?
$directoryToMove = opendir("../folder1/innerFolder/");
// get each entry
while($entryName = readdir($directoryToMove)) {
	rename("sourcePath;", "newPath/");
}
 
 
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of bljak
bljak

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you just rename the folder?  Or are you adding files to an existing folder?  What do you want to do about filename collisions?  Keep the oldest or the newest, or overwrite the older with the new?

6,000 files is probably no trouble at all unless these are gigantic files.
Avatar of Cybervanes
Cybervanes

ASKER

Worked Good Thank You!