From 39c011417fd993920fdd69bd4a9590c57e83d42b Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 16 Apr 2026 23:02:04 +0200 Subject: [PATCH] archive script --- archive.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 archive.sh diff --git a/archive.sh b/archive.sh new file mode 100644 index 0000000..0ebbd0f --- /dev/null +++ b/archive.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +BUILD_DIR=.build +ARCHIVE_DIR=Archive + +MYNAME=RobertFry +STAMP=$(date +"%Y-%m-%d.%H%M%S") + +for filepath in $BUILD_DIR/*.pdf; +do + printf "%s\n" "Archiving $filepath..." + + file=${filepath##*/} + name=$(echo "${file%.*}" | perl -pe 's/(^|[_\s])([a-z])/\U$2/g') + + cp $filepath $ARCHIVE_DIR/$MYNAME.$name.$STAMP.pdf + cp -f $filepath $ARCHIVE_DIR/$MYNAME.$name.pdf +done