commit feda6fc3b12eb18ec5e0a989fbe93dcc87d89489 parent e36cac9803aee829e85ddb360f33bbe6d0634dc3 Author: John Kubach <johnkubach@gmail.com> Date: Thu, 28 Feb 2019 09:59:22 -0500 Create Document Archiving Script This script takes a file and renames it in a standard format. The current naming convention is LASTNAME_DOCUMENTTYPE_TIMESTAMP. Diffstat:
A | src/scripts/archiver.sh | | | 31 | +++++++++++++++++++++++++++++++ |
1 file changed, 31 insertions(+), 0 deletions(-)
diff --git a/src/scripts/archiver.sh b/src/scripts/archiver.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# The mighty archiver + +TIMESTAMP=$(date +%Y%m%d%H%M%S) +EMPLOYEE="" + +# Specify document type +# -s : cover [s]heet +# -l : [l]ibrary form +# -t : [t]emplate +# -p : [p]rogram guide +# -c : [c]onsult letter +# -n : uploader last [n]ame + +while getopts ":n:f:sltpc" opt +do + case "${opt}" in + n) EMPLOYEE=${OPTARG};; + f) FILE=${OPTARG};; + s) DOCTYPE="Cover_Sheet";; + l) DOCTYPE="Lib_Form";; + t) DOCTYPE="Template";; + p) DOCTYPE="Pgrm_Guide";; + c) DOCTYPE="Consult_Letter";; + esac +done +shift $((OPTIND -1)) + +mv $FILE $EMPLOYEE\_$DOCTYPE\_$TIMESTAMP + +exit 0