Skip to content
Snippets Groups Projects
Commit 58f93412 authored by Maciej Wielgosz's avatar Maciej Wielgosz
Browse files

transfer folder with files to the oracle bucket

parent f1468350
Branches master
No related tags found
No related merge requests found
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment