To sync two Firebase Storage buckets (or Google Cloud Storage buckets which are the same), you'll need to install and initialize Cloud SDK first.
To make a mirror of a bucket, use gutil rsync
:
gsutil -m rsync -d -r gs://bucket-source gs://bucket-mirror
Keep in mind that all content not matching the source will be removed from the mirror bucket.
You also can sync buckets across cloud providers, for instance, to make a mirror to Amazon S3:
gsutil -m rsync -d -r gs://bucket-source s3://bucket-mirror-at-s3
Let's breakdown each argument we used:
-m
perform multi-processing synchronization, speedups copy
between cloud buckets.
-d
removes files from the mirror bucket that not present in
the source.
-r
syncronize recursively.