Is it possible to list only the folders in a bucket using the gsutil
tool?
I can't see anything listed here.
For example, I'd like to list only the folders in this bucket:
Is it possible to list only the folders in a bucket using the gsutil
tool?
I can't see anything listed here.
For example, I'd like to list only the folders in this bucket:
Folders don't actually exist. gsutil and the Storage Browser do some magic under the covers to give the impression that folders exist.
You could filter your gsutil results to only show results that end with a forward slash but this may not show all the "folders". It will only show "folders" that were manually created (i.e., not implicitly exist because an object name contains slashes):
gsutil ls gs://bucket/ | grep -e "/$"
Just to add here, if you directly drag a folder tree to google cloud storage web GUI, then you don't really get a file for a parent folder, in fact each file name is a fully qualified url e.g. "/blah/foo/bar.txt"
, instead of a folder blah>foo>bar.txt
The trick here is to first use the GUI to create a folder called blah
and then create another folder called foo
inside (using the button in the GUI) and finally drag the files in it.
When you now list the file you will get a separate entry for
rather than only one