cdstarcat create PATH

    Create objects in CDSTAR specified by PATH.
    When PATH is a file, a single object (possibly with multiple bitstreams) is created;
    When PATH is a directory, an object will be created for each file in the directory
    (recursing into subdirectories).

def create(args):
    """
    cdstarcat create PATH

    Create objects in CDSTAR specified by PATH.
    When PATH is a file, a single object (possibly with multiple bitstreams) is created;
    When PATH is a directory, an object will be created for each file in the directory
    (recursing into subdirectories).
    """
    with _catalog(args) as cat:
        for fname, created, obj in cat.create(args.args[0], {}):
            args.log.info('{0} -> {1} object {2.id}'.format(
                fname, 'new' if created else 'existing', obj))