Google Cloud Storage - gsutil copy file examples

Copy Files from local to GCS

gsutil cp source*.txt gs://my-target-bucket

Use the -r option to recursively copy an entire folder

gsutil cp -r dir gs://my-bucket

In case of large number of files to transfer, you can perform a parallel multi-threaded/multi-processing copy

gsutil -m cp -r dir gs://my-bucket

Copy Files from GCS to local

gsutil cp gs://my-bucket/*.txt .

Copy Files from GCS to GCS

gsutil cp gs://my-bucket/*.txt gs://my-target-bucket/

mCollins

posted on 23 Sep 21

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds