Files
project-work/mv-files.sh
Eric Bell 0c552f61b5 added grading sources;cleanup from last submission
added
-  mv-files.sh - used to stage the 4 core files.
- raccoon-workflow - I'm noting the workflow to make this easier to
  repeat
- grader... and grading... - from the toolkit

other file are residue from last submission
2026-10-16 10:58:45 -04:00

80 lines
2.3 KiB
Bash
Executable File

#!/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<number> 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