Cloud files uploading script

This is a very simple linux bash script to help uploading files to mosso cloud files.

Mosso uploading script:
Updates: Here is a Mac OSX Version (provided by Bryan Rehbein)

You will also need curl .

After you sign up mosso cloud files service, first you need to login your mosso cloud files control panel then navigate to Your Account / API Access, where you will generate your API key. Edit the begin of


Now change to the directory where you want to upload files. e.g. a wordpress installation:

cd /srv/http/wordpress
bash wp-includes/js/jquery
Uploading wp-includes/js/jquery/jquery.table-hotkeys.js .... done.
Uploading wp-includes/js/jquery/interface.js .... done.
Uploading wp-includes/js/jquery/ui.core.js .... done.
Uploading wp-includes/js/jquery/jquery.color.js .... done.
Uploading wp-includes/js/jquery/ui.tabs.js .... done.
Uploading wp-includes/js/jquery/ui.resizable.js .... done.
Uploading wp-includes/js/jquery/jquery.hotkeys.js .... done.
Uploading wp-includes/js/jquery/ui.sortable.js .... done.
Uploading wp-includes/js/jquery/ui.dialog.js .... done.
Uploading wp-includes/js/jquery/jquery.js .... done.
Uploading wp-includes/js/jquery/ui.draggable.js .... done.
Uploading wp-includes/js/jquery/jquery.form.js .... done.
Uploading wp-includes/js/jquery/suggest.js .... done.
Uploading wp-includes/js/jquery/jquery.schedule.js .... done.
HTTP/1.1 202 Accepted
Date: Sat, 14 Mar 2009 00:06:41 GMT
Server: Apache
Content-Length: 0
Content-Type: text/plain; charset=UTF-8

Write down the url on the line begn with X-CDN-URI. This is your mosso CDN url. You can also find this url inside your mosso control panel.

If you want to upload entire current directory, you can execute this script without argument.

  • Pingback: New CDN service | Mudy's Blog()

  • Hareem Haque

    I keep getting the following errors.

    [email protected]:/mnt# bash -readable temp/
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’

    I have PHP5-curl installed..
    Please advise.

    • Yejun

      @Hareem Haque Just use

      bash temp

      My script only take 1 or 0 argument.

  • Hareem Haque

    Sorry to bug you. But i followed your instructions. I still get the following error.
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’
    find: invalid predicate `-readable’

    I think the following code might be miffed in some way.

    for f in $(find $LOC -type f -readable -name *.js); do
    put $f $f application/x-javascript

    • Yejun

      Try remove -readable from these lines. It doesn’t do anything there.
      What’s your operating system?

  • Thanks very much for this script. I’m making a few modifications to it for a client who needs to upload a large amount of data to their Cloud Files account.

    Much appreciated!

  • edjy

    Hi Yejun,

    The script is a good example of how you can use simple shell commands to interact with the Cloud Files’ REST API.

    However, I would like to point out that it isn’t a very efficient way of using Cloud Files. Each cURL invocation is a separate TCP/IP connection to the storage system and each connection will also incur SSL negotiation.

    Granted, if you were uploading a smaller set of large files, this overhead wouldn’t be noticeable since most of the time would be spent doing data transfer. But with a lot of small files (css, javascript, etc), the performance will be lousy.

    I would strongly recommend using one of the Rackspace provided language API’s. The API’s have been designed to re-use the same TCP/IP+SSL connection to the storage system for each file upload/download. It will greatly improve the overall performance.

    Here’s a quick python version of your shell script using the python-cloudfiles API available at

    Hope you and your readers find it useful. If you have any questions/comments, feel free to contact me at ej _at_ racklabs dot com


  • Alex

    Thanks for the script!

  • Hi,
    Great – Thanks.
    Also see for a ruby way of doing this.

  • Ryan

    I get the invalid predicate error on Debian Linux too…

  • Pingback: Ec2dialog.js | Fix Runtime Errors & BSOD's()