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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp script

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
hi!

i'm on my way of integrating NT and AIX system aplication, i just want to have ftp script from AIX directly to NT (vice-versa), get/put file - rename it if a similar file/s exists with date/time attach after the file/s.

thank you.
 
Here is a interactive ftp script, you can modify it to run batch

#!/usr/bin/ksh
clear
#
# Gather ftp information
#
echo "*******************************************************"
echo "* Generic ftp, provide complete responses to prompts. *"
echo "*******************************************************"
echo "Enter User Id for network: \c"
read user
echo ""
echo "Enter the password for id xxxxxx: \c"
read pswd
echo ""
echo "Enter local transfer directory: \c"
read locdir
echo ""
echo "Enter host filename (ex: xxxx.zipped.myfile) : \c"
read hfile
echo ""
echo "Enter local filename (ex: myfile.zip) : \c"
read lfile
echo ""
echo "Enter transfer type (get or put) : \c"
read ttype
echo ""
echo "Enter transfer mode (binary or ascii) : \c"
read tmode
echo ""
#
# Build ftp command file
#
# n is network address
# p is port address for ftp
echo "open nnn.nnn.nnn.nnn pp" >ftpmisc
echo "$user $pswd" >>ftpmisc
echo "lcd $locdir" >>ftpmisc
echo "$tmode" >>ftpmisc
if [ $ttype = "put" ]
then
echo "put $lfile '${hfile}'" >>ftpmisc
else
echo "get '${hfile}' $lfile" >>ftpmisc
fi
echo "bye" >>ftpmisc
echo "" >>ftpmisc

#
# Display command file and get user decision on run or quit.
# If run, run ftp with command file.
#
echo "*******************************************************"
echo "* If the ftp commands below look right, enter a 'y' *"
echo "* to continue with ftp or 'n' to quit. *"
echo "*******************************************************"
tail ./ftpmisc
echo ""
echo "Enter 'y' or 'n': \c"
read answer
if [ $answer = 'y' ]
then
echo "Running ftp......................."
ftp -inv < ftpmisc > ftpmisc.log
echo &quot;ftp complete, review ./ftpmisc.log..........&quot;
else
echo &quot;Quiting ftp..................&quot;
fi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top