public static function recurseCopyIfEdited($src = '', $dst = '', array $excludes = ['php'])
    {
        if (!is_dir($dst) && (!mkdir($dst) && !is_dir($dst))) {
            throw new Exception('Copy dir error, access denied for path: '.$dst);
        }

        $dir = opendir($src);
        if (!$dir) {
            throw new Exception('Unable to read dir: '.$src);
        }

        while (false !== ($file = readdir($dir))) {
            if ($file === '.' || $file === '..') {
                continue;
            }

            if (is_dir($src.'/'.$file)) {
                self::recurseCopyIfEdited($src.'/'.$file, $dst.'/'.$file, $excludes);
                continue;
            }

            if (in_array(substr($file, strrpos($file, '.') + 1), $excludes, null)) {
                continue;
            }


            if (file_exists($dst.'/'.$file) && (filemtime($src.'/'.$file) === filemtime($dst.'/'.$file))) {
                continue;
            }

            copy($src.'/'.$file, $dst.'/'.$file);
            chmod($dst.'/'.$file, 0666);
        }
        closedir($dir);
    }
public static function recurseCopyIfEdited($src = '', $dst = '', array $excludes = ['php'])
    {
        if (!is_dir($dst) && (!mkdir($dst) && !is_dir($dst))) {
            throw new Exception('Copy dir error, access denied for path: '.$dst);
        }

        $dir = opendir($src);
        if (!$dir) {
            throw new Exception('Unable to read dir: '.$src);
        }

        while (false !== ($file = readdir($dir))) {
            if ($file === '.' || $file === '..') {
                continue;
            }

            if (is_dir($src.'/'.$file)) {
                self::recurseCopyIfEdited($src.'/'.$file, $dst.'/'.$file, $excludes);
                continue;
            }

            if (in_array(substr($file, strrpos($file, '.') + 1), $excludes, null)) {
                continue;
            }


            if (file_exists($dst.'/'.$file) && (filemtime($src.'/'.$file) === filemtime($dst.'/'.$file))) {
                continue;
            }

            copy($src.'/'.$file, $dst.'/'.$file);
            chmod($dst.'/'.$file, 0666);
        }
        closedir($dir);
    }
public static function recurseCopyIfEdited ( $ src = '' , $ dst = '' , array $ excludes = [ 'php' ] ) { if ( ! is_dir ( $ dst ) && ( ! mkdir ( $ dst ) && ! is_dir ( $ dst ) ) ) { throw new Exception ( 'Copy dir error, access denied for path: ' . $ dst ) ; } $ dir = opendir ( $ src ) ; if ( ! $ dir ) { throw new Exception ( 'Unable to read dir: ' . $ src ) ; } while ( false !== ( $ file = readdir ( $ dir ) ) ) { if ( $ file === '.' || $ file === '..' ) { continue ; } if ( is_dir ( $ src . '/' . $ file ) ) { self :: recurseCopyIfEdited ( $ src . '/' . $ file , $ dst . '/' . $ file , $ excludes ) ; continue ; } if ( in_array ( substr ( $ file , strrpos ( $ file , '.' ) + 1 ) , $ excludes , null ) ) { continue ; } if ( file_exists ( $ dst . '/' . $ file ) && ( filemtime ( $ src . '/' . $ file ) === filemtime ( $ dst . '/' . $ file ) ) ) { continue ; } copy ( $ src . '/' . $ file , $ dst . '/' . $ file ) ; chmod ( $ dst . '/' . $ file , 0666 ) ; } closedir ( $ dir ) ; }
Recursive copy files if edited

@access public

@param string $src source path
@param string $dst destination path
@param array $excludes excludes extensions

@return void
@throws Exception
@static
Recursive copy files if edited