This method is tested working flawlessly with 69.000 files,120 gb size in total.
Install OCI CLI on your local machine where you planning to upload the folders and files ( following this guide Mac Version)
After Installation, Setting up the Configuration File
oci setup config
Here , it requires your
- user OCID
- Tenancy OCID
- It will generate a new key pair of use an existing one if you have it already ( do be aware that one OCI user can only have max 3 API keys created, so do consider user existing key)
After Configuration
# for host where browser is available
$ oci session authenticate
# for host where NO browser is available,you first need to a host with browser
1. authenticate on a pc with browser
$ oci session authenticate
2. Export profile
$ oci session export --profile <profile_name> --output-file <output_filename>
3. scp profile.zip to the host without browser
4. import
$ oci session import --session-archive <path_to_exported_zip>
To refresh a token
oci session refresh --profile <profile_name>
I don’t really read anywhere how long the session stays valid. However, my experience tells me that it is at least 8 hours. Or probably each $ oci commands will refresh the token.
Once your session is established. Run the following code
oci os object bulk-upload -ns ${mynamespace} -bn ${mybucket} --src-dir ${path/to/upload/directory} --overwrite > logfile.txt
# --overwrite flag overwrites files with the same name in the target bucket
# > logfile.txt , it will pipe all console outputs to a file call logfile.txt ( optional )
Read more about this code from official guide here.