The API itself by design can't support an upload by directory, because the API is purely a contract of how to talk to the service; by itself, it does not have visibility into your local directory structure. Individual tools will, so it's actually possible to supply a directory name to the same Swift CLI tool:
swift upload mycontainer mylocaldir
An alternative API-side solution is the Bulk Upload API within Swift's API. We enable this in both the SoftLayer and Bluemix Object Storage services. If you are able to upload a tar/tar.gz/tar.bz2 archive of your files to the API, you can instruct the API to auto-extract that into your account or container once the upload is complete.
Here is an example of how to use this API:
curl -i -X PUT -T stuff.tar.gz https://example.com/v1/AUTH_abc/container?extract-archive=tar.gz -H X-Auth-Token:mytoken
In order to include a prefix on objects that are extracted from files in your archive, you can extend the container
bit above to include container/my/prefix
. For instance:
https://example.com/v1/AUTH_account/container/my/prefix?extract-archive=tar.gz
If you wish for the archive to be extracted such that the top-level folders in the archive become containers, you would omit the container
segment altogether. This will discard any top-level files in the archive, so make sure to all files are in folders when you create the archive. But you would end up with a URL something like this:
https://example.com/v1/AUTH_account/?extract-archive=tar.gz
Note that the archive formats supported are tar, tar.gz, and tar.bz2.
More details are available in the OpenStack Swift documentation:
http://docs.openstack.org/developer/swift/middleware.html#extract-archive