<- Scripts
#!/bin/bash
# File: dir2asm.sh
# 2017.10.19: Initial Version
#
# Comments: Designed to copy all files in an OS dir to ASM dir.
# User Vars
OS_DIR="/u01/xfer/sb_files/ARCHIVELOG/2017_10_20"
ASM_DIR="+FRA/ORADB_SB/ARCHIVELOG/2017_10_20"
# Confirmation
printf "+------------------------------------+\n"
printf "| About to Copy Files to ASM from OS |\n"
printf "+------------------------------------+\n"
printf "OS_DIR: $OS_DIR\n"
printf "ASM_DIR: $ASM_DIR\n\n"
read -p "Are you sure want to continue [y\n]? " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
printf "\n\n"
# Make ASM Dir
printf "Making ASM dir: $ASM_DIR\n"
asmcmd mkdir $ASM_DIR
# Copy Files
printf "Copying Files...\n\n"
for f in $OS_DIR/*
do
#Just Get File Name (not full path)
fn=${f##*/}
# Extract Name Without Incarnation Characters
f2=${fn::-14}
printf "Copying File: $f\n"
printf "to\n"
printf "$ASM_DIR/$f2\n\n\n"
asmcmd cp $f $ASM_DIR/$f2
done
# End
printf "\nProcess Completed \n\n"