@@ -0,0 +1,1031 @@
+# coding: utf-8%0A%0Aimport argparse%0Aimport os%0Aimport re%0Aimport shutil%0A%0A%0Adef rename_files_in_dir(directory, live_run=False):%0A    if not live_run:%0A        print(%22Performing dry run...%22)%0A        %0A    files = %5Bf for f in os.listdir(directory) if os.path.isfile(f)%5D%0A%0A    for old_path in files:%0A        new_path = re.sub('%5B%5E0-9a-zA-Z-%5C.,_%5D', '_', old_path)%0A        new_path = re.sub('_+', '_', new_path)%0A        new_path = re.sub('_-_', '-', new_path)%0A        new_path = re.sub('(%5E_%7C_$%7C%5C.$)', '', new_path)%0A        if live_run:%0A            shutil.move(old_path, new_path)%0A        else:%0A            print(%22%7B%7D -%3E %7B%7D%22.format(old_path, new_path))%0A%0Aif __name__ == %22__main__%22:%0A    parser = argparse.ArgumentParser()%0A    parser.add_argument('directory', type=str, help=%22which directory's files to rename%22)%0A    parser.add_argument('-l', '--live_run', default=False, action='store_true', help=%22If not given, perform a dry run by showing what would be renamed.%22)%0A    args = parser.parse_args()%0A%0A    rename_files_in_dir(args.directory, args.live_run)%0A

Add conservative rename Python script