@staticmethod<EOL><INDENT>def reorder(<EOL>miz_file_path: typing.Union[str, Path],<EOL>target_dir: typing.Union[str, Path],<EOL>skip_options_file: bool,<EOL>):<DEDENT>
miz_file_path = elib.path.ensure_file(miz_file_path)<EOL>target_dir_path = elib.path.ensure_dir(target_dir, must_exist=False)<EOL>LOGGER.debug('<STR_LIT>', miz_file_path)<EOL>LOGGER.debug('<STR_LIT>', target_dir)<EOL>LOGGER.debug('<STR_LIT>', "<STR_LIT>" if skip_options_file else "<STR_LIT>")<EOL>if not target_dir_path.exists():<EOL><INDENT>LOGGER.debug('<STR_LIT>', target_dir_path)<EOL>target_dir_path.mkdir(exist_ok=True)<EOL><DEDENT>with Miz(miz_file_path, overwrite=True) as miz_:<EOL><INDENT>def mirror_dir(src: Path, dst: Path):<EOL><INDENT>"""<STR_LIT>"""<EOL>LOGGER.debug('<STR_LIT>', src, dst)<EOL>LOGGER.debug('<STR_LIT>')<EOL>diff_ = dircmp(str(src), str(dst), ignore)<EOL>diff_list = diff_.left_only + diff_.diff_files<EOL>LOGGER.debug('<STR_LIT>', diff_list)<EOL>for __diff in diff_list:<EOL><INDENT>source = Path(diff_.left, __diff)<EOL>target = Path(diff_.right, __diff)<EOL>LOGGER.debug('<STR_LIT>', __diff)<EOL>if source.is_dir():<EOL><INDENT>LOGGER.debug('<STR_LIT>', __diff)<EOL>if not target.exists():<EOL><INDENT>LOGGER.debug('<STR_LIT>', __diff)<EOL>target.mkdir()<EOL><DEDENT>mirror_dir(source, target)<EOL><DEDENT>else:<EOL><INDENT>LOGGER.debug('<STR_LIT>', __diff)<EOL>shutil.copy2(str(source), diff_.right)<EOL><DEDENT><DEDENT>for sub in diff_.subdirs.values():<EOL><INDENT>mirror_dir(Path(sub.left), Path(sub.right))<EOL><DEDENT><DEDENT>miz_._encode()<EOL>if skip_options_file:<EOL><INDENT>ignore = ['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>ignore = []<EOL><DEDENT>mirror_dir(Path(miz_.temp_dir), target_dir_path)<EOL><DEDENT>
Re-orders a miz file into a folder (flattened)

Args:
    miz_file_path: source miz file
    target_dir: folder to flatten the content into
    skip_options_file: do not re-order option file