php copy filesteemCreated with Sketch.

in #php7 years ago (edited)
// php copy file

function copyR($src, $dst){
    if (! is_dir($src)) return;
    @mkdir($dst);
    $files = scandir($src);
    foreach ($files as $file) {
        if ($file == '.' || $file == '..')
            continue;
        copy1("$src/$file", "$dst/$file");
    }
}
function copy1($src, $dst){
    if ($src == '.' || $src == '..' || $dst == '.' || $dst == '..')
        return;
    if (is_dir($src))
        copyR($src, $dst);
    else if (is_link($src))
        symlink(readlink($src), $dst);
    else
        copy($src, $dst);
}

Coin Marketplace

STEEM 0.20
TRX 0.19
JST 0.033
BTC 88985.87
ETH 3290.31
USDT 1.00
SBD 2.98