Hello,
I'm trying to simplify the following script. In a perfect world I would like to have the SOURCE_FILE and DEST_DIR variables increment automatically. I would also like to use a loop in the delivery.
At this point I would be happy with just a loop in the SCP or SFTP commands. I have scripts that have with 100+ SOURCE_FILE's all going to diff DEST_DIR's. Just trying to cut down on the manual maintenance of these things.
Thanks in advance for any help pointing me in the right direction,
Jon
##### SPECIFY LOCAL SOURCE LOCATION OF THE FILES #####
SOURCE_DIR1=/opt/xxxxxxx/middleware/scheduled_extracts/data
##### SPECIFY FILES TO BE DELIVERED #####
SOURCE_FILE1=test.txt
SOURCE_FILE2=test2.txt
##### SPECIFY DESTINATION FOLDER FILES TO BE DELIVERED TO ######
DEST_DIR1=/FileDrop/non-encrypted/Report_A
DEST_DIR2=/FileDrop/non-encrypted/Report_B
##### MAKE CONNECTION TO FILEDROP SERVER #########
sftp -b /dev/stdin
user_sftp_test@vmpit-xxxx.yyyy.com <<END_SCRIPT
##### CHANGE TO SOURCE DIRECTORY OF FILES ####
lcd $SOURCE_DIR1
##### CHANGE TO DESTINATION FOLDERS AND PUT THE FILES #####
cd $DEST_DIR1
-put $SOURCE_FILE1
cd $DEST_DIR2
-put $SOURCE_FILE2
bye
END_SCRIPT