"bulk-upload"
*************

* Description

* Usage

* Required Parameters

* Optional Parameters

  * Upload all files from a given directory

  * Forcing object overwrite to resolve object name collision

  * Prevent object overwrite to resolve object name collision

  * Applying metadata

* Global Parameters

* Examples

  * Description

  * Command

  * Output


Description
===========

Uploads all files in a given directory and all subdirectories.


Usage
=====

   oci os object bulk-upload [OPTIONS]


Required Parameters
===================

-bn, --bucket-name [text]

The name of the bucket.

--src-dir [text]

The directory which contains files to upload. Files in the directory
and all subdirectories will be uploaded.


Optional Parameters
===================

--content-encoding [text]

The content encoding to apply to all files being uploaded.

--content-language [text]

The content language to apply to all files being uploaded.

--content-type [text]

The content type to apply to all files being uploaded. If content type
is set to auto, then the CLI will guess the content type of the file.

--disable-parallel-uploads

[DEPRECATED] This option is no longer used. If a file in the directory
will be uploaded in multiple parts, this option disables those parts
from being uploaded in parallel. This applies to all files being
uploaded in multiple parts

--dry-run

Prints the list of files to be uploaded.

--encryption-key-file [filename]

A file containing the base64-encoded string of the AES-256 encryption
key associated with the object.

--exclude [text]

Only upload files which do not match the provided pattern. Patterns
are taken relative to the CURRENT directory. This option can be
provided mulitple times to match on mulitple patterns. Supported
pattern symbols are: 

*: Matches everything

?: Matches any single character

[sequence]: Matches any character in sequence

[!sequence]: Matches any character not in sequence

--from-json [text]

Provide input to this command as a JSON document from a file using the
file://path-to/file syntax.

The "--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/Conte
nt/API/SDKDocs/cliusing.htm#AdvancedJSONOptions

--include [text]

Only upload files which match the provided pattern. Patterns are taken
relative to the CURRENT directory. This option can be provided
mulitple times to match on mulitple patterns. Supported pattern
symbols are: 

*: Matches everything

?: Matches any single character

[sequence]: Matches any character in sequence

[!sequence]: Matches any character not in sequence

--metadata [text]

Arbitrary string keys and values for user-defined metadata. This will
be applied to all files being uploaded. Must be in JSON format.
Example: '{"key1":"value1","key2":"value2"}'

-ns, --namespace, --namespace-name [text]

Object Storage namespace. If not provided, this parameter will be
obtained internally using a call to 'oci os ns get'

--no-multipart

Do not use multipart uploads to upload the file in parts. By default,
files above 128 MiB will be uploaded in multiple parts, then combined
server-side. This applies to all files being uploaded

--no-overwrite

If a file being uploaded already exists in Object Storage with the
same name, do not overwite the object. If neither this flag nor
--overwrite is specified, you will be prompted each time an object
with the same name would be overwritten.

--object-prefix [text]

A prefix to apply to the names of all files being uploaded

--overwrite

If a file being uploaded already exists in Object Storage with the
same name, overwrite the existing object in Object Storage without a
confirmation prompt. If neither this flag nor --no-overwrite is
specified, you will be prompted each time an object with the same name
would be overwritten.

Specifying this flag will also allow for faster uploads as the CLI
will not initially check whether or not the files with the same name
already exist in Object Storage.

--parallel-upload-count [integer range]

The number of parallel operations to perform. Decreasing this value
will make bulk uploads less resource intensive but they may take
longer. Increasing this value may improve bulk upload times, but the
upload process will consume more system resources and network
bandwidth. The maximum is 1000. [default: 10]

--part-size [integer]

Part size (in MiB) to use if uploading via multipart upload
operations. This applies to all files which will be uploaded in
multiple parts. Part size must be greater than 10 MiB

--storage-tier [text]

The storage tier that the objects should be stored in. If not
specified, the objects will be stored in the same storage tier as the
bucket.

Accepted values are:

   Archive, InfrequentAccess, Standard

--verify-checksum

Verify the checksum of the uploaded object with the local file.

   Examples

======================================================================


Upload all files from a given directory
----------------------------------------

   oci os object bulk-upload -ns mynamespace -bn mybucket --src-dir path/to/upload/directory


Forcing object overwrite to resolve object name collision
---------------------------------------------------------

If a file being uploaded already exists in Object Storage, it can be
overwritten without a prompt by using the "--overwrite" flag.

   oci os object bulk-upload -ns mynamespace -bn mybucket --src-dir path/to/upload/directory --overwrite


Prevent object overwrite to resolve object name collision
---------------------------------------------------------

If a file being uploaded already exists in Object Storage, it can be
preserved (not overwritten) without a prompt by using the "--no-
overwrite" flag.

   oci os object bulk-upload -ns mynamespace -bn mybucket --src-dir path/to/upload/directory --no-overwrite


Applying metadata
-----------------

Metadata can be applied when the files are put into Object Storage by
specifying the "--metadata" flag and passing metadata either via a
file or as a string on the command line.

Note: The same metadata will be applied to **all** uploaded files.

   oci os object bulk-upload -ns mynamespace -bn mybucket --src-dir path/to/upload/directory --metadata '{"key1":"value1","key2":"value2"}'
   oci os object bulk-upload -ns mynamespace -bn mybucket --src-dir path/to/upload/directory --metadata file://path/to/my/metadata.json


Global Parameters
=================

Use "oci --help" for help on global parameters.

"--auth-purpose", "--auth", "--cert-bundle", "--cli-rc-file", "--
config-file", "--debug", "--defaults-file", "--endpoint", "--generate-
full-command-json-input", "--generate-param-json-input", "--help", "--
latest-version", "--no-retry", "--opc-client-request-id", "--opc-
request-id", "--output", "--profile", "--query", "--raw-output", "--
region", "--release-info", "--request-id", "--version", "-?", "-d",
"-h", "-v"


Examples
========


Description
-----------

upload all objects in the bucket excluding '.cache' directory.


Command
-------

    oci os object bulk-upload -bn "cli-test" --src-dir ~/cliDirectory --exclude '.cache/*'


Output
------

   {
    "data": [
         {
              "skipped-objects": [],
              "upload-failures": {},
              "uploaded-objects": {
                   "text.txt": {
                        "etag": "cd7a12ad-683c-4a76-a846-f7cb6544428f",
                        "last-modified": "Tue, 29 Sep 2020 17:35:54 GMT",
                        "opc-content-md5": "1B2M2Y8AsgTpgAmY7PhCfg=="
                   }
              }
         }
    ]
   }

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.

       export bucket_name=<substitute-value-of-bucket_name> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/os/object/bulk-upload.html#cmdoption-bucket-name
       export src_dir=<substitute-value-of-src_dir> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/os/object/bulk-upload.html#cmdoption-src-dir

       oci os object bulk-upload --bucket-name $bucket_name --src-dir $src_dir
