diff --git a/oracle_scripts/send_folder_to_bucket.sh b/oracle_scripts/send_folder_to_bucket.sh new file mode 100644 index 0000000000000000000000000000000000000000..44c370acb6a41c1cd15af42cee1336c18ac878d0 --- /dev/null +++ b/oracle_scripts/send_folder_to_bucket.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Check if both arguments are provided +if [ "$#" -ne 2 ]; then + echo "Usage: $0 source_directory bucket_name" + exit 1 +fi + +# Source directory and bucket name parameters +SRC_DIR=$1 +BUCKET_NAME=$2 + +# Function for uploading files +upload_files() { + local src_path=$1 + local dest_path=$2 + + # Iterate over the files and directories + for item in "$src_path"/*; do + # If it's a directory, recursively call this function + if [ -d "$item" ]; then + upload_files "$item" "$dest_path/$(basename "$item")" + else + # If it's a file, upload it to the OCI bucket + oci os object put --bucket-name "$BUCKET_NAME" --name "$dest_path/$(basename "$item")" --file "$item" + fi + done +} + +# Invoke the function with root directory +upload_files "$SRC_DIR" "$(basename "$SRC_DIR")" + +# sample usage +# bash oracle_scripts/send_folder_to_bucket.sh data/simple/ e2e_seg_data \ No newline at end of file