Google GSutil create folder

Bongsky picture Bongsky · Aug 17, 2018 · Viewed 24.3k times · Source

How can u create a new folder inside a bucket in google cloud storage using the gsutil command?

I tried using the same command in creating bucket but still got an error

gsutil mb -l us-east1 gs://my-awesome-bucket/new_folder/

Thanks!

Answer

norbjd picture norbjd · Aug 17, 2018

The concept of directory is abstract in Google Cloud Storage. From the docs (How Subdirectories Work) :

gsutil provides the illusion of a hierarchical file tree atop the "flat" name space supported by the Google Cloud Storage service. To the service, the object gs://your-bucket/abc/def.txt is just an object that happens to have "/" characters in its name. There is no "abc" directory; just a single object with the given name.

So you cannot "create" a directory like in a traditional File System.