Check if a file exists
Updated at:2025-11-03
Check if a file exists
Users can check if a file exists through the following operations:
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 //Get object metadata
5 bos_str_set(&object, TEST_OBJECT_NAME1);
6 s = bos_head_object(options, &bucket, &object, NULL, &resp_headers);
7 print_headers(resp_headers);
8 if (bos_status_is_ok(s)) {
9 printf("ObjectKey exist!\n");
10 } else {
11 printf("ObjectKey not exist!\n");
12 }
13
