import argparse import sys import re import os from pathlib import Path import shutil def main(): # parse arguments parser = argparse.ArgumentParser(description="parse netlist and pack all references to current working directory") parser.add_argument("files", nargs="*", type=argparse.FileType("r")) parser.add_argument("-d", action="store_const", const=True, default=False, help="Dryrun") args = parser.parse_args() fileregex = re.compile(r"(? {}".format(file, files[file])) exit(0) # copy all files found in netlist earlier for file in files: src = Path(file) dst = Path(files[file]) if not src.exists(): print("src does not exist: {}".format(str(src))) continue # create directory dst.parent.mkdir(parents=True) shutil.copyfile(str(src), str(dst)) if __name__ == "__main__": main()