Skip to main content

Interactive Command line Interface to Rackspace Cloud Files

·2 mins

This is a python based command line interface for Rackspace Cloud Files. It provides a nice interactive interface to manage your Cloud Files from the Linux or Window machines using python. I had this code on github for quite some time now, but found out that not many people knew about it, so decided to write this quick post so that it will show up in the google searches and people can use it.

You can grab the code from here: https://github.com/sandeep-sidhu/python-cloudfiles-cmd

I know we can always use python API commands and curl to list things, but it might be helpful for customers who have no programming knowledge, and also they call the upload or download files directly from cron job, etc.

Current Implemented Functions: list containers create container delete container(empty containers) container info - gives information about a container, like total size, publish status, CDN URL. list files delete files upload files download files

Usage example

root@ssidhu-dv6:/python_cf# python cf.py
Login with credentials from ~/.pycflogin file? [yes/no]yes
-Info- Logging in as sandeepsidhu
Interactive command line interface to cloud files
CF>>list
.CDN_ACCESS_LOGS
cloudservers
images
sand
CF>>list sand
New folder/New Text Document.txt
cloudfuse
cloudfuse-0.1.tar.gz
cloudfuse.tar.gz
cloudfuse_1.0-1_amd64.deb
file1
https_webpage_status.png
CF>>quit
root@ssidhu-dv6:/python_cf#

I have created it in a module way, so each of those functions can be called individually without actually running interpreter, so if somebody wants to just grab a list of files in a container, he can just call the individual function files. This will help if somebody wants to write their own scripts.

root@ssidhu-dv6:/python_cf# python cf_list_containers.py
-Info- Logging in as sandeepsidhu
.CDN_ACCESS_LOGS
cloudservers
images
sand
root@ssidhu-dv6:/python_cf# python cf_list_files.py sand
-Info- Logging in as sandeepsidhu
New folder/New Text Document.txt
cloudfuse
cloudfuse-0.1.tar.gz
cloudfuse.tar.gz
cloudfuse_1.0-1_amd64.deb
file1
https_webpage_status.png
root@ssidhu-dv6:/python_cf#

Some ideas about next features to add: delete container along with it’s all files(non empty containers) publish/unpublish containers file info - will provide all the info about a file, size, CDN URL, meta data, etc purge from CDN upload multiple directories, handling of pseudo directories. use of servicenet option

If anybody wants to add any of the above functions then please do and send me a pull request so that we can share it with other people.

– Sandeep Sidhu