#!/bin/bash set -e # Check for dry-run flag dry_run=false if [[ "$1" == "--dry-run" ]]; then dry_run=true shift fi # Array of files to move (with their extensions) and their target directories # Format: files[i] targets[i] files=( "instruction.md" "holistic-rubric.md" "grader-context.md" "atomic-rubric.yaml" ) targets=( "$HOME/workspaces/dataannotation/project-2/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/" "$HOME/workspaces/dataannotation/project-2/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/" "$HOME/workspaces/dataannotation/project-2/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/" "$HOME/workspaces/dataannotation/project-2/worker-toolkit-potion-polyglot-v1.0.1/harbor-tasks/potion-voice-user-ownership/tests/" ) # Check that arrays have same length if [ ${#files[@]} -ne ${#targets[@]} ]; then echo "Error: files and targets arrays must have the same length" >&2 exit 1 fi for i in "${!files[@]}"; do file="${files[$i]}" target_dir="${targets[$i]}" # Split file name into base and extension base="${file%.*}" ext="${file##*.}" # Look for the source file in Downloads with optional -v suffix source_file="" # First try to find a file with the suffix pattern for candidate in /mnt/c/Users/eric/Downloads/${base}-v*.${ext}; do if [[ -f "$candidate" ]]; then source_file="$candidate" break fi done # If not found with suffix, try without suffix if [[ -z "$source_file" ]]; then if [[ -f "/mnt/c/Users/eric/Downloads/${file}" ]]; then source_file="/mnt/c/Users/eric/Downloads/${file}" fi fi # If still not found, exit with error if [[ -z "$source_file" ]]; then echo "Error: Source file not found for ${file}" >&2 exit 1 fi # Ensure target directory exists if [ ! -d "$target_dir" ]; then if $dry_run; then echo "Would create directory: $target_dir" else mkdir -p "$target_dir" fi fi if $dry_run; then # In dry-run mode, just show the target file name (without suffix) echo "${target_dir}${file}" else # Move the file to the target directory with the original file name (without suffix) mv "$source_file" "${target_dir}${file}" fi done