Код: Выделить всё
Storage storage = ...;
// create the file within a directory
storage.create(BlobInfo.newBuilder(TEST_BUCKET_NAME, "dir/foo").build());
// list the bucket, I can see the directory
storage.list(TEST_BUCKET_NAME, Storage.BlobListOption.currentDirectory())
.streamAll().forEach(System.out::println); // prints 'dir/'
// delete the file
storage.delete(TEST_BUCKET_NAME, "dir/foo"); // returns true
// list the bucket, the empty directory not visible
storage.list(TEST_BUCKET_NAME, Storage.BlobListOption.currentDirectory())
.streamAll().forEach(System.out::println); // prints nothing
// delete the directory
storage.delete(TEST_BUCKET_NAME, "dir/"); // returns false
< /code>
Я читал, что каталоги действительно не существуют в GC, но это, вероятно, не соответствует иерархическим пространствам имен. Как я могу удалить каталог через Java API? Я могу удалить каталог с помощью gcloud Storage rm -r gs: // /dir Подробнее здесь: https://stackoverflow.com/questions/794 ... ud-storage