#!/usr/bin/env bash
# Exit immediately if a command exits with a non-zero status
set -e
# 1. Determine the absolute directory where this script resides
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 2. Define relative paths based on the script location
# From .../scripts, ../java/ProfilerAgent.java is one level up and into java/
SOURCE_FILE="${SCRIPT_DIR}/../java/ProfilerAgent.java"
# Target destination directory and file
TARGET_DIR="${SCRIPT_DIR}/../src/main/java/com/citigroup/qffcometbridge/server"
TARGET_FILE="${TARGET_DIR}/ProfilerAgent.java"
# 3. Verify the source file exists
if [ ! -f "$SOURCE_FILE" ]; then
echo "Error: Source file not found at: $SOURCE_FILE" >&2
exit 1
fi
# 4. Create the target package directory structure if it doesn't exist
if [ ! -d "$TARGET_DIR" ]; then
echo "[INFO] Creating target directory structure..."
mkdir -p "$TARGET_DIR"
fi
# 5. Copy the file to the destination
echo "[INFO] Copying ProfilerAgent.java to target location..."
cp "$SOURCE_FILE" "$TARGET_FILE"
echo "[SUCCESS] ProfilerAgent.java has been successfully copied to:"
echo " $TARGET_FILE"
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)