Link to home
Start Free TrialLog in
Avatar of bkreynolds48
bkreynolds48

asked on

find latest files and ftp to another server

I have a script that will ftp all archive log files from one machine to another but need to find just the files that have not been copied over and just ftp them.

I am on AIX 5.3

Here is the script I am using...

#!/bin/ksh
set -xv
################################################################ script to ftp archive logs.
###############################################################
export ORACLE_BASE=/app/oracle/product
export ORACLE_ADMIN=/app/oracle/product/admin
export ORACLE_HOME=/app/oracle/product/db10.2
export LD_LIBRARY_PATH=/app/oracle/product/db10.2/lib
#
###############################################################
#
cd /oradata/prod/logarch1
echo  `date +%m%d%y-%H:%M` > /home/oracle/arch/ftp_arch.log
for next_file in  $(find /oradata/prod/logarch1 -name 'prod_arc*.log'  -print   )
do
ftp -ivn servername>> /home/oracle/arch/ftp_arch.log  <<eof
user username password
binary
cd /oradata/prod/logarch1
put $(basename ${next_file})
bye
eof
done
echo  `date +%m%d%y-%H:%M` >> /home/oracle/arch/ftp_arch.log
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

hi, do you need to use FTP or are other programs an option as well? i'm thinking of rsync instead
Avatar of bkreynolds48
bkreynolds48

ASKER

Given the rules where I work can't use rsync
In that case, I'd be doing this in a few steps:

- get remote file list using FTP
- get local file list
- diff remote and local file list (call this to_ftp)
- put files that are in the to_ftp list to remote location

It will require some scripting though...
so how do I script this?
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks