简体   繁体   中英

Google Cloud Storage: Images Wont Copy To Other Buckets

I have create a method that transfers a set amount of images from a called folder through google cloud storage, however when running it creates the directory but does not transfer any images

def Cloud_Transfer(UserLabel, UserCounter):
    storage_client = storage.Client()
    gcs_bucket_store = 'export'
    gcs_bucket_upload = 'active'
    counter_limit = UserCounter
    label = UserLabel
    label_prefix = 'verified images/' + label + '/'
    source_bucket = storage_client.get_bucket(gcs_bucket_store)
    blobs = source_bucket.list_blobs(prefix = label_prefix)
    counter = 0
    for blob in blobs:
        if counter == counter_limit:
            print("Done")
        else:
            source_blob = source_bucket.blob(blob.name)
            destination_bucket = storage_client.get_bucket(gcs_bucket_upload)
            new_blob = source_bucket.copy_blob(source_blob, destination_bucket, blob.name)
            counter += 1
    return counter

the images are located in a path "verified images/"label"/image.jpg" I expect this file to be transferred across however only end up with the path and no image copied

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM