diff --git a/fuclean.sh b/fuclean.sh new file mode 100755 index 0000000000000000000000000000000000000000..41c0d6edccc98dd4710d2d7a4a5668d595a1e153 --- /dev/null +++ b/fuclean.sh @@ -0,0 +1,21 @@ +#! /bin/sh + +if [ ! -f 'grades.csv' ] && [ ! -f 'grades.xls' ]; then + printf "Execute within the directory containing 'grades.csv'\n" >&2 + exit 1 +fi + +# Delete comments.txts so we can more easily delete empty directories. +# Otherwise they would still contain this one empty file. +find . -type f -name "comments.txt" -exec rm {} \; + +# Delete all empty directories in the directory containing grades.csv +find . -type d -empty -delete + +# Re-create the (now deleted) feedback attachment directories and comments.txts for the student directories that are left. +for dir in *; do + if [ -d "${dir}" ]; then + mkdir "${dir}/Feedback Attachment(s)" + touch "${dir}/comments.txt" + fi +done diff --git a/install.sh b/install.sh index 2b6c8af40f2f410c1d8a4630abc120557f4fa4bf..4df6257bad017a2a37fd1362f47c97c97873dc6f 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #! /bin/sh -scripts="fixpdf.sh fucopy.sh fufixpdf.sh fuzip.sh fuxournalexport.sh fixtimes.sh" +scripts="fixpdf.sh fucopy.sh fufixpdf.sh fuzip.sh fuxournalexport.sh fixtimes.sh fuclean.sh" destdir="${DESTDIR:=$HOME/.local/bin}" mkdir -p "$destdir"