def METHOD_NAME(src_root, dest_root, rewrite):
    for src_dir, dirs, files in os.walk(src_root):
        dest_dir = src_dir.replace(src_root, dest_root, 1)
        os.mkdir(dest_dir)
        for filename in files:
            src_file = os.path.join(src_dir, filename)
            dest_file = os.path.join(dest_dir, filename)
            if src_file.endswith(".html"):
                with open(src_file, "r", encoding="utf-8") as src:
                    content = src.read()
                with open(dest_file, "w", encoding="utf-8") as dest:
                    dest.write(rewrite(content))
            else:
                shutil.copyfile(src_file, dest_file)