Uploading and overwriting folders in GCP Console / Cloud Storage / Buckets / Folders

Hi Google community, Our process for uploading new content to our bucket files doesn't appear to be working? our process for overwriting buckets/folders that are already live with updates is to: 

1. Go to folder within Bucket on GCP Console

2. Click upload Folder

3. Select file to upload (extracted file, folder name identical)

4. Pop up box asking for actions: select overwrite and then apply to all files and upload

The above steps would usually overwrite the Content folder bringing in new changes to the following folders:

Assets, Goodbye.html, Index, Lib, Locales

However, now instead of this it is bringing over all singular files within the above folders and our URL appears blank.

Advice greatly appreciated.

2 1 137
1 REPLY 1

Hello @MA2014,

Welcome to Google Cloud Community!

This is an intended behavior. Take a look at Object namespace. Cloud storage objects resides in a flat namespace, which means that objects don't reside within subdirectories in a bucket. As stated in the documentation:


For example, if you create an object named folder1/file.txt in the bucket your-bucket, the path to the object is your-bucket/folder1/file.txt, and Cloud Storage has no folder named folder1 stored within it. From the perspective of Cloud Storage, the string folder1/ is part of the object's name.


When you're doing your process, which is clicking UPLOAD FOLDER, you are actually uploading the contents of your folder into that directory. This will result to overwriting the objects in the bucket. Overwritten objects will lose their public access/urls. 

You can do the following steps to overwrite the contents of a selected folder:

  1. In your bucket, go to the folder you wish to UPDATE
  2. Once you're inside the folder, click UPLOAD FOLDER
  3. Select the folder that you wish to upload. Click overwrite and apply to all objects
  4. Once done, you can check the TIME CREATED and you'll notice that the contents are overwritten while the main directory of your bucket remains unchanged.

If the above option doesn't work, you can contact Google Cloud Support to further look into your case. Hope it helps, thanks!

Top Labels in this Space