Skip to content
Snippets Groups Projects

fucopy: Allow multiple patterns

Merged jonahbeneb02 requested to merge jonahbeneb02/tutorscripts:fucopy-multiple into main
1 file
+ 7
5
Compare changes
  • Side-by-side
  • Inline
+ 7
5
#! /bin/sh
if [ $# -ne 1 ] || [ ! -f 'grades.csv' ]; then
if [ $# -lt 1 ] || [ ! -f 'grades.csv' ]; then
printf "Usage: %s <pattern>\n" $(basename $0) >&2
printf "Supply a pattern matching files to be copied, e.g. '*.pdf'\n" >&2
printf "Execute within the directory containing 'grades.csv'\n" >&2
exit 1
fi
pattern=$1
patterns=$@
find \
-wholename "*/Submission attachment(s)/$pattern" \
-execdir cp {} '../Feedback Attachment(s)' \;
for pattern in $patterns; do
find \
-wholename "*/Submission attachment(s)/$pattern" \
-execdir cp {} '../Feedback Attachment(s)' \;
done
Loading