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