@@ -0,0 +1,1084 @@
+from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter%0Aimport os%0Aimport shutil%0A%0A%0Adef main(args):%0A    os.makedirs(args.output_dir, exist_ok=True)%0A%0A    for dirname in args.dirnames:%0A        if not(os.path.isdir(dirname)):%0A            continue%0A%0A        for basename in os.listdir(dirname):%0A            src = os.path.join(dirname, basename)%0A            if not os.path.isfile(src):%0A                continue%0A%0A            dest = os.path.join(args.output_dir, basename)%0A            if not os.path.isfile(dest):%0A                shutil.copy(src, dest)%0A                continue%0A%0A            if os.path.getsize(src) %3E os.path.getsize(dest):%0A                shutil.copy(src, dest)%0A%0A%0Aif __name__ == '__main__':%0A    parser = ArgumentParser(%0A        description=('Copy files from multiple folders and overwrite based on '%0A                     'size'),%0A        formatter_class=ArgumentDefaultsHelpFormatter)%0A    parser.add_argument('-dirs', '--dirnames', required=True, nargs='+')%0A    parser.add_argument('-o', '--output-dir', required=True)%0A    args = parser.parse_args()%0A%0A    main(args)%0A

copy files greedy