I have moved files and folders over to google cloud storage (GCS). I am finding it difficult to understand the prefixes and delimiters in the GCS documentation.
What I want to do is essentially replace the path/location of locally stored files with GCS location. E.g.
It is currently coded for local path:
Variable = "C:\\Users\\admin\\Documents\\Folder1\\doc3.csv"
I need it written to search for the file in GCS like below:
Variable = "https://storage.cloud.google.com/MYBUCKETNAME/Folder1/doc3.csv?supportedpurview=project"
This obviously doesn't work but I have the below code which connects to the bucket but I am struggling to direct it to the specific file.
from google.cloud import storage
import os
client = storage.Client()
bucket = client.bucket('mybucketname')
blobs = bucket.list_blobs(prefix='Folder1')
for blob in blobs:
print(blob.name)
So the output of this gives the following files in that specific folder:
doc1.csv
doc2.csv
doc3.csv
For my variable, what do I write as my filepath to doc3.csv. This is what I am struggling with.