Cloud Function To Copy All The Files From A Storage Bucket To A Folder Inside The Same Gcs Storage Bucket
Solution 1:
Actually Google Cloud Storage does not have genuine "folders". In the Cloud Storage console, the files in your bucket are presented in a hierarchical tree of folders (just like the file system on your local hard disk) but this is just a way of presenting the files: there aren't genuine folders/directories in a bucket. The Cloud Storage console just uses the different parts of the file paths to "simulate" a folder structure, by using the "/" delimiter character.
This doc on Cloud Storage and gsutil explains and illustrates very well this "illusion of a hierarchical file tree".
So, in other words, it's up to you to use a file name (or file path) that is composed by the "folder/directory" name, then the "/" delimiter character and finally the file name. E.g.: fileName = "summer1970/pic1234.jpg"
. As clarified in the comments below, the illusion of a hierarchical file tree is created via the files naming not via the bucket naming.
Post a Comment for "Cloud Function To Copy All The Files From A Storage Bucket To A Folder Inside The Same Gcs Storage Bucket"