Download all files from a Google Cloud Storage bucket (in OSX)

To download all files from a Google Cloud Storage bucket (if you are using Google Cloud services like App Engine etc) is actually quite easy but you’ll need to use gsutil to do it. See the docs at https://cloud.google.com/storage/docs/gsutil. You will need the Google Cloud SDK installed so you can run “gcloud”.

I’m using OSX and did the following:

Download gsutil fromĀ https://storage.googleapis.com/pub/gsutil.tar.gz

Extract to your home directory:

tar xfz gsutil.tar.gz -C $HOME

Go to $HOME/gsutil and check the version, it may ask if you want to update Google Cloud components:

gsutil version -l

If you need to, update Google Cloud components:

gcloud components update

Authenticate with your Google Cloud account:

gcloud auth login

Set the correct project (in this case “project101″):

gcloud config set project project101

Copy everything recursively from the bucket “bucketname” to the directory “bucketname”:

gsutil -m cp -R gs://bucketname

Done!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>