php recursive copy

This function copy recursive files and folders in php

function recursive_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != ‘.’ ) && ( $file != ‘..’ )) {
if ( is_dir($src . ‘/’ . $file) ) {
recurse_copy($src . ‘/’ . $file,$dst . ‘/’ . $file);
}
else {
copy($src . ‘/’ . $file,$dst . ‘/’ . $file);
}
}
}
closedir($dir);
}

Публикувано в linux, php

Вашият коментар

Вашият имейл адрес няма да бъде публикуван. Задължителните полета са отбелязани с *

*