#!/bin/bash

# ✅ Export AWS credentials at the top of script
export AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY  
export AWS_SESSION_TOKEN
export AWS_DEFAULT_REGION

find . -type f -name "*trial-edition*" -exec bash -c '
  ret=0
  for file do
    aws s3 mv "$file" s3://devops-team-bucket-dev/prod_nexus_version_archive/xld-trial-whole-sync/"${file:2}" || ret="$?"
  done
  exit "$ret"' bash {} +
