after editing my script I would shortly like to explain what i want to do:
This is my Script, can someone please tell me if this is going to work? I am not sure about the syntax and also not sure if nr. 3 and 4. send mail works like this.
#!/bin/sh
#check if files are in folder
declare -a arrCSV #create array
for file in *.csv
do
arrCSV=("${CSV[@]}" "$file")
done
shopt -s nullglob
for file in read*.csv; do
#run on all files starting with "read" and ending with ".csv"
for find $LOCATION -name $file -type f -mmin -60 do
if
sqlldr read*.csv
then mv "$file" "$HOME/fail/" ;
else{ echo "Failed to load" | mail -s "FAIL" email@email.com}
done
done
for file in write*.csv; do
#run on all files starting with "write" and ending with ".csv"
for find $LOCATION -name $file -type f -mmin -60 do
if
sqlldr write*.csv
then mv "$filen" "$HOME/unisem/fail/" ;
else { echo "Failed to load 2" | mail -s "FAIL" email@email.com}
done
done
You don't need an array if the read... and write... files can be processed in any order:
shopt -s nullglob
for file in read*.csv; do
# run on all files starting with "read" and ending with ".csv"
sqldr ...
done
for file in write*.csv; do
# run on all files starting with "write" and ending with ".csv"
sqldr ...
done