On Mac it is quite simple to upload and download files from object storage in bulk ,but on windows it is quite difficult since we dont have any available documentation for this.
I use Windows 8 and once I need to do a backup of all the files from object storage container .There are around 5000 pdf files and there is no option where we can directly download all these in a single go from object storage.We need to select one by one.
So then I thought of using Swift CLI and after long struggle I succeeded on windows.So hope this helps someone.
First we need to have Swift CLI set up on your local machine.
For that we need to install Python,PIP,Swift client and keystone client.
First we need to set up virtualenv since on windows it doesnt support the openstack version 3 and Object storage is based on V3 .
But fortunately, python provides a way to install various version of command via “virtualenv” mechanism. It is possible to run various version of python in a virtual environment. And surely it worked for Bluemix Object Storage service too.
First we need to download python on your local machine and then install it and set the path
For window python installation you can refer this
Then we need to install pip. Even for that you can refer the above link.
Then open cmd in the browse to the folder where you have pip installed and then u need to install virtualenv
>pip install virtualenv
Then go to virt folder location
Then install python swift client,python-keystoneclient and ndg-httpsclient module.
>pip install python-swiftclient
>pip install python-keystoneclient
>pip install –upgrade ndg-httpsclient
Environment is set now and we can use the swift commands.
Firsy we need to set the environment variables to access the object storage which you can get those from object storage service credentials
The values like <user-id>, <password> and <project-id> can be obtained from Bluemix Object Storage service UI. Once the details are correct u are authenticated and connected to object storage.
Then we can see the containers list using the following command
Below are the Swift commands for downloading and uploading
Download a particular file from container
>swift download <container-name> <file-name>
Download all the files with in a container
>swift download <container-name> .
Uploading file in to a container
Go to the folder location where you have these files
>swift upload <container-name> <filename>
Uploading all the files in a folder to a container
>swift upload <container-name>