I need to copy data across Google Cloud Platform - Cloud Storage(GCS) buckets (source is a GCS bucket and destination is a GCS bucket) Since I perform copy along some more operations in small batches I use the gsutil cp command from bash shell script
The exact command I use is as follows
# objpaths_file has object paths as gs://source_bucket/obj1, ...
objlist=objpaths_file
cat $objlist| gsutil -m cp -I gs://target_bucket
The objects to be copied have custom metadata fields. This way of copying objects using "gsutil cp" does copy custom metadata key values, provided the metadata key has an associated non null value In case a custom metadata key has null value then the copied metadata does not have that key in the destination (the key with null value is dropped from copy)
So my questions are
- Is there any other mechanism that will allow me to programatically copy the objects with custom metadata with all keys (regardless of the key value being NULL) ?
- Is there an option to change this behaviour of the gsutil cp command ?
- Alternatively I am also open to suggestions for recreating missing metadata keys with and filling those with null values programatically in destination bucket. Offcourse this option should only add missing fields with key and null values but leave key-value pairs with valid values intact !!
And another less relevant question :-)
- Would this gsutil behaviour (skipping custom metadata key if value is NULL) be expected behaviour , or would it rather amount to an unexpected behaviour/ defect? should I approach google support seeking a fix in that case ?)
Thanks for your response
Yogesh