#!/usr/bin/env python3

# Platform-independent `mkdir`

import argparse
import pathlib
import sys

def main():
    parser = argparse.ArgumentParser(description='Platform-independent `mkdir`')
    parser.add_argument('-p', '--parents', action='store_true', required=False, help='no error if existing, make parent directories as needed')
    parser.add_argument('dir', action='store', nargs='+')
    ns = parser.parse_args()
    for p in ns.dir:
        pathlib.Path(p).mkdir(parents=ns.parents, exist_ok=True)
    return 0

if __name__ == '__main__':
    sys.exit(main())

@@ -437,16 +437,33 @@
 ns.dir:%0A
+        try:%0A    
         
@@ -506,24 +506,58 @@
 ents
-, exist_ok=True)
+)%0A        except FileExistsError:%0A            pass
 %0A   

Make mkdir.py work under python3 versions below 3.5 (#8194)