Warning
This content has been generated by machine translation. The translations are automated and have not undergone human review or validation.
14.1.2.2 File Upload via CLI
- Some of the pages below are summarized. Please refer to the following link for full details.
-
Query the Object Storage Namespace.
oci os ns get
-
Search the list of objects on the bucket
oci os object list -ns <object_storage_namespace> -bn <bucket_name>
-
Examples of execution
PS D:\> oci os ns get { "data": "cnzdbcmqu9s8" } PS D:\> oci os object list -ns cnzdbcmqu9s8 -bn ExampleBucketForCLI { "prefixes": [] }
-
-
Bucket에 Object upload
oci os object put -ns <object_storage_namespace> -bn <bucket_name> --file <file_location> --name <object_name> --no-multipart
-
Windows Examples of execution
PS D:\ForObjectStorage> dir 디렉터리: D:\ForObjectStorage Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2022-01-12 오후 7:01 images -a---- 2022-01-12 오후 5:27 152 index.html PS D:\ForObjectStorage> oci os object put -bn ExampleBucketForCLI --file index.html { "etag": "4235d07c-1ef4-42db-b64a-4fb045de2fcd", "last-modified": "Tue, 18 Jan 2022 02:42:23 GMT", "opc-content-md5": "B8Iehaa6j58u+qMiWnNldg==" } PS D:\ForObjectStorage> oci os object list -ns cnzdbcmqu9s8 -bn ExampleBucketForCLI { "data": [ { "archival-state": null, "etag": "4235d07c-1ef4-42db-b64a-4fb045de2fcd", "md5": "B8Iehaa6j58u+qMiWnNldg==", "name": "index.html", "size": 152, "storage-tier": "Standard", "time-created": "2022-01-18T02:42:23.945000+00:00", "time-modified": "2022-01-18T02:42:23.945000+00:00" } ], "prefixes": [] }
-
-
Bulk upload objects to the Bucket
oci os object bulk-upload -ns <object_storage_namespace> -bn <bucket_name> --src-dir <source_directory_location> --no-multipart
-
Windows Examples of execution
PS D:\ForObjectStorage> oci os object bulk-upload -bn ExampleBucketForCLI --src-dir . Uploaded images/icons8-oracle-96.png [####################################] 100% Uploaded index.html [####################################] 100% { "skipped-objects": [], "upload-failures": {}, "uploaded-objects": { "images/icons8-oracle-96.png": { "etag": "388a319c-b5d0-4a51-bacf-9d9fe84bc621", "last-modified": "Tue, 18 Jan 2022 03:05:04 GMT", "opc-content-md5": "HkJF80OO/DlmKI7usBCg4Q==" }, "index.html": { "etag": "883369a7-4701-4bd9-8351-3fbaada61fbe", "last-modified": "Tue, 18 Jan 2022 03:05:05 GMT", "opc-content-md5": "B8Iehaa6j58u+qMiWnNldg==" } } }
-
-
Check the result
-
Uploaded source folder
-
Uploaded objects
The files in the folder are uploaded as shown in the picture. However, you can see that the file uploaded by cli is of the application/octet-stream type.
-
Multipart Upload
When uploading a large size file, such as a Custom Image file, it will take a lot of time to upload. In this case, you can upload a single file into multiple files and upload them in parallel for faster uploads. In addition, when a network error occurs during transmission, it is possible to upload a larger file more stably by retrying each part in error.
oci os object put -ns <object_storage_namespace> -bn <bucket_name> --file <file_location> --name <object_name> --part-size <upload_part_size_in_MB> --parallel-upload-count <maximum_number_parallel_uploads>
-
Windows execution example
This is an example of uploading a 2.28GB file into 100 MB units and uploading them in parallel at the same time, taking 3 minutes and 57 seconds.
PS D:\ForObjectStorage> date 2022년 1월 18일 화요일 오후 12:25:22 PS D:\ForObjectStorage> oci os object put -bn ExampleBucketForCLI --file big_file.iso --part-size 100 --parallel-upload-count 5 Upload ID: 3b38b958-3010-4d6d-5e84-55d189b787cc Split file into 24 parts for upload. Uploading object [####################################] 100% { "etag": "2217a0e6-2ae3-4ae8-9507-03d2f36a38ec", "last-modified": "Tue, 18 Jan 2022 03:29:18 GMT", "opc-multipart-md5": "mnHbvK3Eed2+o54P1P7VgA==-24" } PS D:\ForObjectStorage> date 2022년 1월 18일 화요일 오후 12:29:19 PS D:\ForObjectStorage>
-
Check the result
-
Note
By default, files above 128 MiB will be transferred in multiple parts, then combined.
PS D:\ForObjectStorage> oci os object put -bn ExampleBucketForCLI --file big_file.iso Upload ID: 75e4106e-bf1f-ffd0-5630-c78b68b6168b Split file into 19 parts for upload. Uploading object [####################################] 100% { "etag": "cf5d681b-90a3-409c-b732-1e6c6028c046", "last-modified": "Tue, 18 Jan 2022 03:37:46 GMT", "opc-multipart-md5": "eFqxsX7ROrZUQ0HrQYI/zw==-19" }
As an individual, this article was written with my personal time. There may be errors in the content of the article, and the opinions in the article are personal opinions.