#!/bin/sh ################################################################## ## File: purge-file-rename ## Date: September 13, 2011 ## Author: BRANT PUTTKAMMER ## Purpose: A script to rename _HOLD_ files after PURGEs run ## PROPERTY OF BRANT PUTTKAMMER, PLEASE CONTACT ME IF YOU HAVE QUESTIONS ## PLEASE USE CAUTION WHEN RUNNING THIS PROGRAM ON YOUR SYSTEM ################################################################## # DECLARE DATE VARIABLES BELOW export CurrentHour=$(date +"%H") export CurrentSecond=$(date +"%S") export CurrentDayName=$(date +"%u") FileNameCounter=10 echo "This script will rename all purge files as needed." echo "" echo "now renaming CASH*OS*PURGE, along with PURGE0*, PURGE1*, CU597* and CU598-3* files..." echo "" echo "" cd $PWD/_HOLD_ echo "current directory is $PWD/_HOLD_" for i in *CASH\*OS\*PURGE*; do echo item: $i; mv $i 1_PURGE.TLR.OVSH_$CurrentSecond$FileNameCounter; FileNameCounter=$((FileNameCounter+1)); done for i in 1_PURGE0*; do echo item: $i; mv $i 1_PURGE.TRANS.HISTORY_$CurrentSecond$FileNameCounter; FileNameCounter=$((FileNameCounter+1)); done for i in 1_PURGE1*; do echo item: $i; mv $i 1_PURGE.ACCT.TYPES_$CurrentSecond$FileNameCounter; FileNameCounter=$((FileNameCounter+1)); done for i in 1_CU597*; do echo item: $i; mv $i 1_PURGE.CLNT.RECORDS1_$CurrentSecond$FileNameCounter; FileNameCounter=$((FileNameCounter+1)); done for i in 1_CU598-3*; do echo item: $i; mv $i 1_PURGE.INVENT.DTLS3_$CurrentSecond$FileNameCounter; FileNameCounter=$((FileNameCounter+1)); done date pwd echo "Done with purge.rename!" echo ""