Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP Scripting

Status
Not open for further replies.

BobLoblaws

Programmer
Nov 20, 2001
149
CA
I have a ftp script named ftpscript.txt that looks like this:
open 142.218.71.30
username
password
ascii
hash
send "xxtest.p"
quit


In windows, the command line ftp can run the script like this:
c:\>ftp -s:ftpscript.txt

But in AIX, it says that -s is an invalid parameter.
My UNIX book says that the windows ftp was made from the unix ftp. So how do I run the script in AIX?

Thanks,
 
you can try this as well;

1) create a file with the following;
ftp hostname <<EOF
ascii
send filename
EOF
2) create a file called .netrc in the home directory with permissions of 400 ie (r-------- )
3) edit the .netrc to contain a line as below;
machine hostname login xxxxx password yyyyy
4) execute file in 1 from shell.
 
#!/bin/ksh
FTPresult=X
###User=xxxx
#Host=xxx.xxx.xxx.xx
#File=test.pag
#Password=xxxxxx
#export FTPresult User Password File Host
#FTPresult=`ftp -n 2>$1 << eof
FTPresult=`ftp -ni << eof
open ${HOST_MACHINE}
user ${USER} ${PASSWORD}
cd \directory
put ${PAGER_FILE} #file to send to destination
close
quit
eof`
# validate whether it was successful
if [ &quot;X${FTPresult}&quot; = &quot;X&quot; ]
then
echo &quot;Transfer OK&quot;
else
echo &quot;Transfer Failed (${FTPresult})&quot;
fi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top