When gsutil, we once again treat the buckets as source and destination directories:
- Use the gsutil cp command as follows to upload file(s) to the bucket. Note that the command needs both source and destination URLs:
gsutil cp <Source> <Destination>
For instance:
gsutil cp gs://loonycorn-bucket-00/image1.png gs://loonycorn-
bucket-01
- Do not forget to add a file extension or the file shall not upload
- Later, you can use the ls command to verify your upload
- Similarly, the gsutil mv command can be used to move data from one bucket to another:
gsutil mv gs://loonycorn-bucket-00/image1.png gs://loonycorn-bucket-01
- While moving data from one bucket to another, the permission of the buckets may be different. We can make a choice between whether we want the moved objects to maintain their previous bucket's permission or whether we want them to inherit the new bucket's permission. Providing -p as the argument allows us to maintain the permissions from a previous bucket and the same logic applies to copying data as well:
gsutil mv -p gs://loonycorn-bucket-00/image1.png gs://loonycorn-bucket-01