Skip to content

Instantly share code, notes, and snippets.

@christophchamp
Created November 25, 2013 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christophchamp/7636987 to your computer and use it in GitHub Desktop.
Save christophchamp/7636987 to your computer and use it in GitHub Desktop.
Upload a tarball to a Rackspace Cloud Files container and extract its contents.
#!/bin/bash
# SEE: http://docs.rackspace.com/files/api/v1/cf-devguide/content/Extract_Archive-d1e2338.html
# NOTE: That "Content-Type: " _must_ be blank if you want the API to guess the types!
token=`./curl_authenticate.sh |grep ^X-Auth-Token |cut -d: -f2`
tarball=/home/champ/tmp/test_cf_extract.tar.gz
container=tmp
region=dfw
curl -i -XPUT \
-H "X-Auth-Token: $token" \
-H "Content-Type: " \
https://storage101.${region}1.clouddrive.com/v1/MossoCloudFS_ffff-ffff-ffff-ffff-ffff/${container}/?extract-archive=tar.gz \
--data-binary @$tarball
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment