How to back up GCP Storage file and folder to local?

Here I’m using gsutil tool command line tool to download all file to local.

Install gsutil

First, you need install gsutil tool in your local environment.

curl https://sdk.cloud.google.com | bash

Restart your shell after installed.

exec -l $SHELL

Initialize gcloud environment:

gcloud init

Now, your can create a local folder for backup gcp storage file.

Download file

For example, download mypicture.png from bucket to local:

gsutil -m cp -R gs://BUCKETNAME/mypicture.png ~/my_local_folder/

Download folder

gsutil -m cp -R gs://BUCKETNAME ~/my_local_folder/

Reference https://cloud.google.com/storage/docs/gsutil/commands/cp