Home » Infrastructure » Unix » Passing parms to FTP Script???
Passing parms to FTP Script??? [message #97326] Wed, 13 March 2002 14:44 Go to next message
Jo
Messages: 16
Registered: September 1999
Junior Member
I've generated an ftp script but I don't know how to pass it parms. I have scheduled a script to run daily to retreive files from ftp site which are a derivitive of the date. I can create the daily filenames with WSH but have not been successful in calling the ftpscript file with parms. Any help! I'll admit I'm not good with ftp.
Re: Passing parms to FTP Script??? [message #97330 is a reply to message #97326] Thu, 14 March 2002 11:09 Go to previous messageGo to next message
Grant
Messages: 578
Registered: January 2002
Senior Member
You can dynamically create the script and put variables in it and execute it. Here is what I do in unix:

#!/bin/ksh
#
# Script to use FTP using a file created dynamically.
# 3/15/01 Grant_howell
#
# Get the password and plug it in PWD.
PWD=`cat $HOME/passwd/ams_system`

# Create the file to receive commands for FTP.
echo "Begin FTP Script..."
echo "open cronus" > ftptmp.scr
echo "user oracle $AMS_PWD" >> ftptmp.scr
echo "ascii" >> ftptmp.scr
echo "cd scripts" >> ftptmp.scr
echo "lcd ams" >> ftptmp
echo "mget *" >> ftptmp.scr
echo "cdup" >> ftptmp.scr
echo "close" >> ftptmp.scr

ftp -inv < ftptmp.scr
echo "END FTP Script..."
rm ftptmp.scr

Here is a DOS version (you can modify it to use %1, %2...):

echo off
echo open anteros > ftptmp.scr
echo user oratest %1 >> ftptmp.scr
echo binary >> ftptmp.scr
echo cd /ora/u1/test/testappl/ap/11.5.0/reports/US >> ftptmp.scr
echo put APXPBFEG.rdf >> ftptmp.scr
echo bye >> ftptmp.scr

echo on
ftp -inv < ftptmp.scr
del ftptmp.scr

echo END FTP Script...
Re: Passing parms to FTP Script??? [message #97432 is a reply to message #97326] Mon, 06 May 2002 04:43 Go to previous message
Jared
Messages: 10
Registered: June 2001
Junior Member
i love you man =) hehe
Previous Topic: Re: Installing Oracle 8i for Redhat Linux 6x on Redhat Linux 7.1
Next Topic: Re: Calling Oracle Procedures from Unix shell
Goto Forum:
  


Current Time: Wed Sep 23 11:18:18 CDT 2020