public static function recursiveCopy($src, $dst)
    {
        if (is_dir($src)) {
            if (!is_dir($dst) && !mkdir($dst)) {
                throw new IOException("Cannot mkdir '$dst'", 0, null, $path);
            }
            $files = scandir($src);
            foreach ($files as $file) {
                if ($file != "." && $file != "..") {
                    self::recursiveCopy("$src/$file", "$dst/$file");
                }
            }
        } elseif (file_exists($src)) {
            if (!copy($src, $dst)) {
                throw new IOException("Cannot copy '$src' to '$dst'", 0, null, $src);
            }
        }
    }
public static function recursiveCopy($src, $dst)
    {
        if (is_dir($src)) {
            if (!is_dir($dst) && !mkdir($dst)) {
                throw new IOException("Cannot mkdir '$dst'", 0, null, $path);
            }
            $files = scandir($src);
            foreach ($files as $file) {
                if ($file != "." && $file != "..") {
                    self::recursiveCopy("$src/$file", "$dst/$file");
                }
            }
        } elseif (file_exists($src)) {
            if (!copy($src, $dst)) {
                throw new IOException("Cannot copy '$src' to '$dst'", 0, null, $src);
            }
        }
    }
public static function recursiveCopy ( $ src , $ dst ) { if ( is_dir ( $ src ) ) { if ( ! is_dir ( $ dst ) && ! mkdir ( $ dst ) ) { throw new IOException ( "Cannot mkdir '$dst'" , 0 , null , $ path ) ; } $ files = scandir ( $ src ) ; foreach ( $ files as $ file ) { if ( $ file != "." && $ file != ".." ) { self :: recursiveCopy ( "$src/$file" , "$dst/$file" ) ; } } } elseif ( file_exists ( $ src ) ) { if ( ! copy ( $ src , $ dst ) ) { throw new IOException ( "Cannot copy '$src' to '$dst'" , 0 , null , $ src ) ; } } }
cp -r
cp - r