#!/bin/bash

target_minio="http://42.192.52.227:9000"
local_minio="http://localhost:9000"
minio_user_name="cmii"
minio_user_pass="B#923fC7mk"
bucket_name="octopus"

main() {
  # alies
  #   mc alias set local ${local_minio} ${minio_user_name} ${minio_user_pass}
  #   mc alias set public ${target_minio} ${minio_user_name} ${minio_user_pass}

  mc mb public/${bucket_name}

  echo ""
  # ls
  local file
  for file in $(mc ls local/${bucket_name}/ | awk '{print$6}'); do
    echo "the current file is ${file}"
    mc cp local/$bucket_name/"$file" public/$bucket_name/"$file"
  done

}

main
