#!/bin/sh
NAME=$1

if [ -z $NAME ]; then
    echo "Please pass the ID of the tutorial session"
    exit
fi

mkdir -p ${NAME}

for i in $(seq -f "%02g" $((10#$NAME-1)) -1 1); do
    if [ -d $i ]; then
        cp -vR $i/* ${NAME}/
        break
    fi
done

mkdir -p ${NAME}/src

for i in $(seq -f "%02g" 1 $NAME); do
    cp -vnR ../lean/love${i}_*_{demo.,exercise_,homework_}*lean ${NAME}/src
done
