def c_create(api, args, verbose=False):
    """
Create a new object uploading files from a directory as bitstreams::

    usage: cdstar create [options] <DIR>

    options:
        --metadata=<JSON>    Path to metadata in JSON, or JSON literal.
        --include=<PATTERNS> comma-separated list of filename patterns to include.
        --exclude=<PATTERNS> comma-separated list of filename patterns to exclude.
"""
    def patterns(opt):
        res = _split(opt)
        if res:
            return r'|'.join([fnmatch.translate(x) for x in res])

    includes = patterns(args['--include'])
    excludes = patterns(args['--exclude'])

    obj = api.get_object()
    if verbose:
        yield 'object created at'
        yield api.url(obj)

    if set_metadata(args['--metadata'], obj):
        if verbose:
            yield 'adding metadata'
            yield api.url(obj.metadata)

    for root, dirs, files in os.walk(args['<DIR>']):
        # exclude/include files
        files = [os.path.join(root, f) for f in files]
        if excludes:
            files = [f for f in files if not re.match(excludes, f)]
        if includes:
            files = [f for f in files if re.match(includes, f)]

        for fname in files:
            bitstream = obj.add_bitstream(fname=fname)
            if verbose:
                yield 'adding bitstream'
                yield api.url(bitstream)

    yield api.url(obj)
Create a new object uploading files from a directory as bitstreams::

    usage: cdstar create [options] <DIR>

    options:
        --metadata=<JSON>    Path to metadata in JSON, or JSON literal.
        --include=<PATTERNS> comma-separated list of filename patterns to include.
        --exclude=<PATTERNS> comma-separated list of filename patterns to exclude.