Programmer Thoughts

By John Dickinson

Simple script to upload content to Cloud Files

November 20, 2010

I recently realized that, on the infrequent occasion that I need to share screenshots and other things with others, I don’t have a good way to quickly make content available to others. Sure, I can upload something to imgur or even use something more complicated like the Cloud Files control panel, but I’d like something simpler. Little apps like ShoveBox and TinyGrab can be helpful, but what if I want something more generic? I’m a Cloud Files developer, so I naturally assumed that the idea solution would be to put stuff in to a CDN-enabled container in Cloud Files.

I wrote a little command-line script that takes pathnames as parameters, uploads the files to a specific container, and prints the new object’s CDN URL to stdout. Then I aliased the script to “upload” in .bash_profile, and now I simply type upload some/file, and I get the sharable URL.

The code is available on my github account.

This work is licensed under a Creative Commons Attribution 3.0 Unported License.

The thoughts expressed here are my own and do not necessarily represent those of my employer.