Josh
Josh

Reputation: 2587

How can I copy the contents of a firebase storage bucket from one project to another?

I'm using firebase storage to store profile pictures. I've created two projects: MyApp and MyApp-Dev. I can easily download the json data from the MyApp database and upload it to MyApp-Dev database. Is there a way to do something similar to transfer the images from one project to another? Without the user's profile pictures it makes testing MyApp-Dev quite difficult.

Upvotes: 11

Views: 2849

Answers (2)

Katsumi Honda
Katsumi Honda

Reputation: 311

I did copy bucket A to be stored in the root of bucket B,

gsutil -m cp -r gs://<bucket-a>/* gs://<bucket-B>

Upvotes: 15

Eduardo Rosado
Eduardo Rosado

Reputation: 313

If you have the Google Cloud SDK installed you can use the gsutil command.

Install GCP SDK

gsutil doc

And you could move the information between buckets. Example:

gsutil -m cp -r gs://<bucket-myapp-name> gs://<bucket-myapp-dev-name>

-m to run in parallel. This can significantly improve performance if you are performing operations on a large number of files over a reasonably fast network connection

cp copy

-r recursive

Upvotes: 15

Related Questions