``bulk-download`` ================= .. contents:: :local: :depth: 1 Description ------------ Downloads all objects which match the given prefix to a given directory. Usage ----- .. code-block:: none oci os object bulk-download [OPTIONS] Required Parameters -------------------- .. option:: -bn, --bucket-name [text] The name of the bucket. .. option:: --dest-dir, --download-dir [text] The directory where retrieved objects will be placed as files. This directory will be created if it does not exist. Optional Parameters -------------------- .. option:: --delimiter [text] When this parameter is set, only objects whose names do not contain the delimiter character (after an optionally specified prefix) are returned. Scanned objects whose names contain the delimiter have part of their name up to the last occurrence of the delimiter (after the optional prefix) returned as a set of prefixes. Note: Only '/' is a supported delimiter character at this time. .. option:: --dry-run Prints the list of files to be downloaded. .. option:: --encryption-key-file [filename] A file containing the base64-encoded string of the AES-256 encryption key associated with the object. .. option:: --exclude [text] Only process files which do not match the specified pattern. Patterns are applied relative to the current directory. This option can be specified multiple times to match on multiple patterns. Supported pattern symbols are:  \*: Matches everything ?: Matches any single character [sequence]: Matches any character in sequence [!sequence]: Matches any character not in sequence .. option:: --from-json [text] Provide input to this command as a JSON document from a file using the file://path-to/file syntax. The :option:`--generate-full-command-json-input` option can be used to generate a sample json file to be used with this command option. The key names are pre-populated and match the command option names (converted to camelCase format, e.g. compartment-id --> compartmentId), while the values of the keys need to be populated by the user before using the sample file as an input to this command. For any command option that accepts multiple values, the value of the key can be a JSON array. Options can still be provided on the command line. If an option exists in both the JSON document and the command line then the command line specified value will be used. For examples on usage of this option, please see our "using CLI with advanced JSON options" link: https://docs.cloud.oracle.com/iaas/Content/API/SDKDocs/cliusing.htm#AdvancedJSONOptions .. option:: --include [text] Only process files which match the specified pattern. Patterns are applied relative to the current directory. This option can be specified multiple times to match on multiple patterns. Supported pattern symbols are:  \*: Matches everything ?: Matches any single character [sequence]: Matches any character in sequence [!sequence]: Matches any character not in sequence .. option:: --multipart-download-threshold [integer range] Objects larger than this size (in MiB) will be downloaded in multiple parts. The minimum allowable threshold is 128 MiB. .. option:: -ns, --namespace, --namespace-name [text] The top-level namespace used for the request. If not provided, this parameter will be obtained internally using a call to 'oci os ns get' .. option:: --no-multipart Do not transfer the file in multiple parts. By default, files above 128 MiB will be transferred in multiple parts, then combined. .. option:: --no-overwrite If a file with the same name as an object already exists in the download directory, do not overwite it. If neither this flag nor --overwrite is specified, you will be prompted each time a file would be overwritten .. option:: --overwrite If a file with the same name as an object already exists in the download directory, overwrite it. If neither this flag nor --no-overwrite is specified, you will be prompted each time a file would be overwritten. .. option:: --parallel-operations-count [integer range] The number of parallel operations to perform. Decreasing this value will make the process less resource intensive but it may take longer. Increasing this value may decrease the time taken, but the process will consume more system resources and network bandwidth. The maximum is 1000. [default: 10] .. option:: --part-size [integer range] Part size (in MiB) to use when the file is split into multiple parts and then combined. Part size must be greater than 10 MiB and defaults to 128 MiB. .. option:: --prefix [text] Retrieve all objects with the given prefix. Omit this parameter to get all objects in the bucket .. code-block:: none Examples -------- Download all objects in the bucket ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -ns mynamespace -bn mybucket --download-dir path/to/download/directory Download all objects that match a given prefix ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -ns mynamespace -bn mybucket --download-dir path/to/download/directory --prefix myprefix You can download all objects that match a given prefix by specifying the --prefix flag. In the above example, "--prefix myprefix" would match object names such as myPrefix_textfile1.txt, myPrefix_myImage.png etc. If you have named your objects so that they exist in Object Storage as a hierarchy, e.g. level1/level2/level3/myobject.txt, then you can download objects at a given level (and all sub levels) by specifying a prefix: .. code-block:: none :class: copy-code-block oci os object bulk-download -ns mynamespace -bn mybucket --download-dir path/to/download/directory --prefix level1/level2/ This will download all objects of the form level1/level2/, level1/level2/leve3/, level1/level2/leve3/level4/ etc. Limiting downloaded objects using a prefix and delimiter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -ns mynamespace -bn mybucket --download-dir path/to/download/directory --prefix level1/level2/ --delimiter / If you have named your objects so that they exist in Object Storage as a hierarchy, e.g. level1/level2/level3/myobject.txt, and you only want to download objects at a given level of the hierarchy, e.g. example everything of the form level1/level2/ but not level1/level2/leve3/ or any other sub-levels, you can specify a prefix and delimiter. Currently the only supported delimiter is / Overwriting or skipping files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -ns mynamespace -bn mybucket --download-dir path/to/download/directory --overwrite oci os object bulk-download -ns mynamespace -bn mybucket --download-dir path/to/download/directory --no-overwrite If files with the same name as the objects being downloaded already exist in the download directory, you can opt to overwrite them with the --overwrite option, or preserve them with the --no-overwrite option. Global Parameters ------------------ Use ``oci --help`` for help on global parameters. :option:`--auth-purpose`, :option:`--auth`, :option:`--cert-bundle`, :option:`--cli-auto-prompt`, :option:`--cli-rc-file`, :option:`--config-file`, :option:`--connection-timeout`, :option:`--debug`, :option:`--defaults-file`, :option:`--endpoint`, :option:`--generate-full-command-json-input`, :option:`--generate-param-json-input`, :option:`--help`, :option:`--latest-version`, :option:`--max-retries`, :option:`--no-retry`, :option:`--opc-client-request-id`, :option:`--opc-request-id`, :option:`--output`, :option:`--profile`, :option:`--proxy`, :option:`--query`, :option:`--raw-output`, :option:`--read-timeout`, :option:`--realm-specific-endpoint`, :option:`--region`, :option:`--release-info`, :option:`--request-id`, :option:`--version`, :option:`-?`, :option:`-d`, :option:`-h`, :option:`-i`, :option:`-v` Example using required parameter ------------------ Copy the following CLI commands into a file named example.sh. Run the command by typing "bash example.sh" and replacing the example parameters with your own. Please note this sample will only work in the POSIX-compliant bash-like shell. You need to set up `the OCI configuration `__ and `appropriate security policies `__ before trying the examples. .. code-block:: none :class: copy-code-block export bucket_name= # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/os/object/bulk-download.html#cmdoption-bucket-name export download_dir= # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/os/object/bulk-download.html#cmdoption-download-dir oci os object bulk-download --bucket-name $bucket_name --download-dir $download_dir Other Examples ------------------ Description ~~~~~~~~~~~~ Download all objects in the bucket excluding '.cache' directory. Command ~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -bn "cli-test" --download-dir ~/cliDirectory --exclude '.cache/*' Output ~~~~~~~~~~~~ .. code-block:: json { "data": [ { "download-failures": {}, "skipped-objects": [] } ] } Description ~~~~~~~~~~~~ Downloads all objects in the bucket to the specified directory Command ~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -bn bucket-client --dest-dir my_download_folder Output ~~~~~~~~~~~~ .. code-block:: json { "download-failures": {}, "downloaded-objects": [ "b_text.txt", "a_text.txt" ], "skipped-objects": [] } Description ~~~~~~~~~~~~ Prints the list of files to be downloaded. Command ~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -bn bucket-client --dest-dir my_download_folder --dry-run Output ~~~~~~~~~~~~ .. code-block:: json { "output": "a_text.txt \n b_text.txt" } Description ~~~~~~~~~~~~ Downloads all objects in the bucket which do not match the specified pattern Command ~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -bn bucket-client --dest-dir my_download_folder --exclude 'a*' Output ~~~~~~~~~~~~ .. code-block:: json { "download-failures": {}, "downloaded-objects": [ "b_text.txt" ], "skipped-objects": [] } Description ~~~~~~~~~~~~ Downloads all objects in the bucket which matches the specified pattern Command ~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -bn bucket-client --dest-dir my_download_folder --include 'a*' Output ~~~~~~~~~~~~ .. code-block:: json { "download-failures": {}, "downloaded-objects": [ "a_text.txt" ], "skipped-objects": [] } Description ~~~~~~~~~~~~ Downloads all objects in the bucket and will not overwrite local files having same name, without showing confirmation prompt Command ~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -bn bucket-client --dest-dir my_download_folder --no-overwrite Output ~~~~~~~~~~~~ .. code-block:: json { "download-failures": {}, "downloaded-objects": [], "skipped-objects": [ "a_text.txt", "b_text.txt" ] } Description ~~~~~~~~~~~~ Downloads all objects in the bucket and will overwrite local files having same name, without showing confirmation prompt Command ~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -bn bucket-client --dest-dir my_download_folder --overwrite Output ~~~~~~~~~~~~ .. code-block:: json { "download-failures": {}, "downloaded-objects": [ "a_text.txt", "b_text.txt" ], "skipped-objects": [] } Description ~~~~~~~~~~~~ Downloads all objects in the bucket with specified prefix Command ~~~~~~~~~~~~ .. code-block:: none :class: copy-code-block oci os object bulk-download -bn bucket-client --dest-dir my_download_folder --prefix a Output ~~~~~~~~~~~~ .. code-block:: json { "download-failures": {}, "downloaded-objects": [ "a_text.txt" ], "skipped-objects": [] }