gsutil: why ls returns directory itself

Viewed 198

I got

$ gsutil ls gs://ml_models_c/ref7/test/model/2/
gs://ml_models_c/ref7/test/model/2/                        <= why this?
gs://ml_models_c/ref7/test/model/2/saved_model.pb
gs://ml_models_c/ref7/test/model/2/variables/
$ gsutil ls gs://seldon-models/tfserving/mnist-model/1/
gs://seldon-models/tfserving/mnist-model/1/saved_model.pb
gs://seldon-models/tfserving/mnist-model/1/variables/

Why there is gs://ml_models_c/ref7/test/model/2/ in the first command output? Why the second command does not return itself?

It seems that I can rm it.

Thanks

1 Answers

At the API level, Cloud Storage doesn't have the concept of folders, everything is stored as long file names that might have slashes in them.

In this case, you likely have an object named gs://ml_models_c/ref7/test/model/2/, but no object named gs://seldon-models/tfserving/mnist-model/1/

If you don't need the gs://ml_models_c/ref7/test/model/2/ object, you can delete it and it will no longer show in the results for gsutil ls

Related