How to not copy source folder gsutil bucket to bucket?

Viewed 52

I simply would like to copy recursively the content of one of my bucket directories to another bucket.

When i run :

gsutil -m cp -r gs://my_first_bucket/source_dir/ gs://my_second_bucket/target_dir

I would like to not find source_dir inside target_dir but only its content.

I have also tried (not working) to remove the / at the end of the source_dir path :

gsutil -m cp -r gs://my_first_bucket/source_dir gs://my_second_bucket/target_dir

Thanks in advance !

1 Answers

You are looking for wildcards. Try the following command:

gsutil -m cp -r 'gs://my_first_bucket/source_dir/*' gs://my_second_bucket/target_dir

Do make sure you add the single quotes around the source bucket URL. Checkout the documentation for more information on that.

Related