@@ -0,0 +1,2187 @@
+#!/usr/bin/env python3%0A%0A# Move all files into a directory to the current directory,%0A# then delete the directory%0A%0Aimport argparse%0Aimport os%0Aimport sys%0A%0A%0Adef check_conflicts(directories, destination):%0A    conflits = %5B%5D%0A%0A    for directory in directories:%0A        for filename in os.listdir(directory):%0A            if os.path.exists(os.path.join(destination, filename)):%0A                conflicts.append(os.path.join(directory, filename))%0A%0A    return conflicts%0A%0A%0Adef splat(directory, destination, verbose=False):%0A    for filename in os.listdir(directory):%0A        src = os.path.normpath(os.path.join(directory, filename))%0A        dest = os.path.normpath(os.path.join(destination, filename))%0A%0A        if verbose:%0A            print(f%22renamed '%7Bsrc%7D' -%3E '%7Bdest%7D'%22)%0A        os.replace(src, dest)%0A%0A    if verbose:%0A        print(f%22removed '%7Bdirectory%7D'%22)%0A    os.rmdir(directory)%0A%0A%0Aif __name__ == %22__main__%22:%0A    argparser = argparse.ArgumentParser(%0A        description=%22Flatten a directory, moving all its contents into the current directory.%22,%0A    )%0A    argparser.add_argument(%0A        %22-v%22,%0A        %22--verbose%22,%0A        dest=%22verbose%22,%0A        action=%22store_true%22,%0A        help=%22Execute verbosely, printing out each action taken%22,%0A    )%0A    argparser.add_argument(%0A        %22-n%22,%0A        %22--no-clobber%22,%0A        dest=%22no_clobber%22,%0A        action=%22store_true%22,%0A        help=%22Do not clobber existing files: error if conflicts are encountered%22,%0A    )%0A    argparser.add_argument(%0A        %22-d%22,%0A        %22--destination%22,%0A        dest=%22destination%22,%0A        default=%22.%22,%0A        help=%22The directory to move flattened files into%22,%0A    )%0A    argparser.add_argument(%0A        %22directory%22,%0A        nargs=%22+%22,%0A        help=%22The directories to be acted upon%22,%0A    )%0A    args = argparser.parse_args()%0A%0A    if args.no_clobber:%0A        conflicts = check_conflicts(args.directory, args.destination)%0A        if conflicts:%0A            conflicts_fmt = %22%5Cn%22.join(f%22 * %7Bpath%7D%22 for path in conflicts)%0A            print(f%22Cannot splat, would clobber existing files:%5Cn%7Bconflicts_fmt%7D%22, file=sys.stderr)%0A            sys.exit(1)%0A%0A    for directory in args.directory:%0A        splat(directory, args.destination, args.verbose)%0A

Add splat script.