TSM "Inkrementális" archiváló szkript

tsm_archiver.sh
#!/bin/bash
DIRECTORIES="/DIR1 /dir2"
WORKDIR="/root/tsm_archiver"
LOGFILE="${WORKDIR}/tsm_archiver.log"
echo "------------------------ $(date) START ----------------------" >> "$LOGFILE"
for DIR in $DIRECTORIES; do
        FILELIST="${WORKDIR}/tsm_archiver_$(echo ${DIR} | sed 's/[^a-zA-Z0-9\-\.]/_/g').lst"
        dsmc q ar $DIR/ -subdir=y | awk "/${DIR:1}/"'{print $5}' | sort > "${FILELIST}.archived"
        [[ ! -f "${FILELIST}.archived" ]] && touch "${FILELIST}.archived"
        find "$DIR" | sort > $FILELIST
        comm -23 "${FILELIST}" "${FILELIST}.archived" > "${FILELIST}.new"
        dsmc ar -filelist="${FILELIST}.new" -auditlogging=basic -auditlogname="$LOGFILE" -desc="$DIR nolimit havi" | tee -a "$LOGFILE"
        RC=${PIPESTATUS[0]}
        echo "------------------------ $(date) END ----------------------" >> "$LOGFILE"
        if [[ $RC -eq 0 ]]; then
                mv "${FILELIST}" "${FILELIST}.archived"
        fi
done