#!/usr/bin/env python from argparse import ArgumentParser from pathlib import Path import shutil def fill_mock_backup_dir(rootdir: Path, target_dir: Path, verbose=False): if (target_dir / "marker").exists(): return for property_file in rootdir.glob("*.properties"): if verbose: print(f"Property file: {property_file}") shutil.copy2(property_file, target_dir / property_file.name) for other_file in filter( lambda path: path.suffix != ".properties", rootdir.glob("*") ): if other_file.is_file(): if verbose: print(f"Data/apk file: {other_file}") dest = target_dir / other_file.name dest.touch(exist_ok=True) (target_dir / "marker").touch() if __name__ == "__main__": parser = ArgumentParser() parser.add_argument("backup_dir", type=Path) parser.add_argument("mock_dir", default=".", type=Path, nargs="?") parser.add_argument("-v", "--verbose", action="store_true") args = parser.parse_args() fill_mock_backup_dir(args.backup_dir, args.mock_dir, args.verbose)