How to move files in Google Cloud Storage from one bucket to another bucket by Python -
are there api function allow move files in google cloud storage 1 bucket in bucket?
the scenario want python move read files in bucket b bucket. knew gsutil not sure python can support or not.
thanks.
using google-api-python-client, there example on storage.objects.copy page. after copy, can delete source storage.objects.delete.
destination_object_resource = {} req = client.objects().copy(         sourcebucket=bucket1,         sourceobject=old_object,         destinationbucket=bucket2,         destinationobject=new_object,         body=destination_object_resource) resp = req.execute() print json.dumps(resp, indent=2)  client.objects().delete(         bucket=bucket1,         object=old_object).execute()      
Comments
Post a Comment