查看文件是否存在
更新时间:2024-04-24
查看文件是否存在
用户可通过如下操作查看某文件是否存在:
C
1 options = bos_request_options_create(p);
2 init_test_request_options(options, is_cname);
3 bos_str_set(&bucket, TEST_BUCKET_NAME);
4
5 //获取对象元数据
6 bos_str_set(&object, TEST_OBJECT_NAME1);
7 s = bos_head_object(options, &bucket, &object, NULL, &resp_headers);
8 print_headers(resp_headers);
9 if (bos_status_is_ok(s)) {
10 printf("ObjectKey exist!\n");
11 } else {
12 printf("ObjectKey not exist!\n");
13 }
14