ConFoo Montreal 2026: Call for Papers

Voting

: max(four, four)?
(Example: nine)

The Note You're Voting On

dblanchard1 at bbox dot fr
11 years ago
If you want to copy all files recursively from a source directory to some destination :

$directory = new RecursiveDirectoryIterator("./source_path/");

foreach (new RecursiveIteratorIterator($directory) as $filename=>$current) {

$src = $current->getPathName();
$dest = "./destination_path/" . $current->getFileName();

echo "copy " . $src . " => " . $dest . "\n";

copy($src, $dest);
}

I hope it can help someone because when I looked for this solution I had to transform another example to get it.

<< Back to user notes page

To Top