GoogleCloudPlatform / GoogleCloudPlatform/gsutil
gsutil ls gs://bucket-directory lists itself
- Dominant language
- Python
- Stars
- 918
- Forks
- 335
- PR merge metrics
- No merged PRs in 30d
Description
When a folder is created through "Create Folder" in the UI, gsutil ls gs://bucket/folder lists itself.
Steps to reproduce:
1. Create a bucket
2. Create a folder through "CREATE FOLDER" in the UI
3. Upload a file to the newly created folder
3. Run gsutil ls gs://[bucket]/[folder]
Expected Output:
```
gs://bucket/folder/file
```
Actual Output:
```
gs://bucket/folder
gs://bucket/folder/file
```
I understand that this is because "folders" don't actually exist in GCS and creating a folder through the UI is really just creating an "object" which is why the folder is listed. However this can cause confusion as gsutil is supposed to provide the illusion of a filesystem and `gsutil ls` should be matched as closely as it can with `ls` for typical Unix/Unix-like OS. Can the 'folder' be abstracted during these ls commands?
Screenshot:

Contributor guide
Research direction
Start by reproducing the reported `gsutil ls gs://bucket/folder` behavior with a UI-created folder marker and an uploaded file. Trace the `gsutil ls` entry point and its handling of folder objects; done means the marker is omitted while the file remains listed, with coverage for the reported command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, python
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100