On my laptop I have a directory which contains a subdirectory, which in turn contains a bunch of HTML files. It looks like this:

% ls -lR 2000-09
total 12
drwxrwxr-x 2 skip skip 12288 Nov 18 07:42 html

total 648
-rw-r--r-- 1 skip skip 18489 Dec  4  2019 index.html
-rw-r--r-- 1 skip skip 18489 Dec  4  2019 maillist.html
-rw-r--r-- 1 skip skip  3468 Dec  4  2019 msg00000.html
-rw-r--r-- 1 skip skip  3270 Dec  4  2019 msg00001.html
-rw-r--r-- 1 skip skip  3194 Dec  4  2019 msg00002.html

I use gsutil to upload that directory to my bucket:

% gsutil -m cp -r 2000-09 gs://my-secret-bucket/
Copying file://2000-09/html/msg00070.html [Content-Type=text/html]...
Copying file://2000-09/html/msg00060.html [Content-Type=text/html]...           
Copying file://2000-09/html/msg00029.html [Content-Type=text/html]...           
Copying file://2000-09/html/msg00052.html [Content-Type=text/html]...           

It looks fine through the console. I see 2000-09, inside that html, and inside that a bunch of files. So far, so good.

Now I open up a cloud shell and mount that bucket using gcsfuse:

gcsfuse my-secret-bucket ~/mnt

but the resulting directory view appears empty:

me@cloudshell:~ (whatever)$ ls -l ~/mnt
total 0
me@cloudshell:~ (whatever)$

Then I upload a couple files directly into my bucket (at the top level)

% gsutil -m cp wrench?.jpg gs://my-secret-bucket/
Copying file://wrench1.jpg [Content-Type=image/jpeg]...
Copying file://wrench2.jpg [Content-Type=image/jpeg]...                         
/ [2/2 files][  1.0 MiB/  1.0 MiB] 100% Done                                    
Operation completed over 2 objects/1.0 MiB.

I confirm that they are there in the console, then list my mounted bucket again. They are visible and I can read them:

$ ls -l ~/mnt
total 1049
-rw-r--r-- 1 me me 432451 Nov 18 19:09 wrench1.jpg
-rw-r--r-- 1 me me 640526 Nov 18 19:09 wrench2.jpg
me@cloudshell:~ (whatever) cksum mnt/wrench1.jpg
3659533210 432451 mnt/wrench1.jpg
me@cloudshell:~ (whatever)$

It seems that files are visible at the top level, but I can't figure out how to make the directory and its contents visible. The web interface is extremely confusing for an old Unix guy like me who wants to see stuff like rw-r--r-- when viewing long listings and execute chmod 0644 ... to make it so when it doesn't look right. How do I make my 2000-09 object/folder/directory and (recursively) its entire contents visible? Ultimately, I want to have it visible to a GCP-hosted Flask web app (also owned by me, so not necessarily publicly visible).

2 Answers 2


According to this related thread, gcsfuse by default might not show directories that were not created directly. I tried doing the exact steps you described, and my directories were not visible from the mounted folder (top level files did show up correctly). The same answer explains that using the --implicit-dirs flag changes this behavior to show the directories. I created another mount with the flag, and the folders were visible from Cloud Shell:

gcsfuse --implicit-dirs BUCKET_NAME ~/mountedDir

For mounting the storage bucket on a directory, I used the gcsfuse documentation, which goes into detail about mounting procedures. It is important to review the possible side effects from using this flag, such as additional API calls.

  • 1
    Dang, nice! I have been drowning in a sea of Google Cloud pages trying to figure this out. --implicit-dirs solved my problem. It doesn't work yet from my Linux laptop, but that clearly seems to be a more straightforward problem related to missing credentials.
    – smontanaro
    Commented Nov 24, 2021 at 17:51

I fixed this problem by creating the directory structure with the mkdir command afterwards, for example:

Using the gsutil command ( gsutil rsync -r /test/ gs:bucket/) to copy the test directory and its contents to the bucket:

/test/text0.txt /test/text1.txt

And using a VM with the bucket mounted, I recreated the directory with the command mkdir /mountedbucketdir/test

This way all files were immediately visible, without having to use --implicit-dirs and deal with its problems. It is inconvenient to recreate the directory structure but this frees you from the burden on operations and latency of GCP.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .