Files
usaco/lib/cmd/list.sh
T

20 lines
636 B
Bash

# usaco list
list_by_mtime() { # list subdirs of $1 oldest-first by last modification
[[ -d "$1" ]] || return 0
for d in "$1"/*/; do
[[ -d "$d" ]] || continue
# newest mtime of any file in the problem dir
printf '%s\t%s\n' "$(find "$d" -type f -printf '%T@\n' | sort -n | tail -1)" "$(basename "$d")"
done | sort -n | cut -f2 | sed 's/^/ /'
}
echo "== Solving =="
list_by_mtime "$ROOT/solving"
echo
echo "== Solved =="
list_by_mtime "$ROOT/solved"
if [[ -d "$ROOT/skipped" && -n "$(ls -A "$ROOT/skipped" 2>/dev/null)" ]]; then
echo
echo "== Skipped =="
list_by_mtime "$ROOT/skipped"
fi