FTP Scripts

combination of 1 & 3

I am asking the User to enter the Source Server

he enters the source userid& Password

Loggin to the source server and getting some files

This is my basic scenario

but i have a requirement that my filename and directory paths are not Static , so i need to define the directory to login to the source server and need to define the filenames and also need to define where i need to place the file (get) to the target server

Please let me know if this is a bit confusing

Thanks

ok - here's a sample format of the file that specifies what you're 'get'-ing where it supposed to go:

listOfFile.txt:

/sourceDirPath1/sourceFileName1 /destinationDirPath1
/sourceDirPath1/sourceFileName2 /destinationDirPath1
/sourceDirPath2/sourceFileName1 /destinationDirPath2
/sourceDirPath3/sourceFileName1 /destinationDirPath3

Here's the modifed code:

#!/bin/ksh

listOfFiles='listOfFile.txt'

ftp -nv <<EOF
open $FTP_SRVR
user $FTP_USR
pass $FTP_PWD
ascii
$(sed 's#^\([^ ][^ ]*\)/\([^ ][^ ]*\) \(.*\)#get \1/\2 \3/\2#' ${listOfFiles})
bye
EOF

I'll let you work on the format of your 'listOfFiles' file and the corresponding changes to the script, but the above should give you enough of the 'hint' of the general idea.
Good luck!

i have a same situation , i somehow manged to read from a file and getting the files and source to target ..

After that , i need to replace few characeters in each file ,

can i have a hint how can i login to that directory , using param.txt in the target server

Thankyou!!

#!/bin/ksh

for file in $(< ${listOfFiles} )
do
     ex - ${file} <<EOF
%s/foo/bar/g
wq!
EOF
done

Hi

Thanks for your help , when i use the logic , script is in Hung Mode and when also it is not loggin in to that directory , please correct me if i am wrong

Thanks

If you dont need
mget *
to prompt you for your answer, u can use "-i" option with ftp

Rakesh UV

Thanks , but i am not sure of this one .. when i give the following in my script

example :
listOfFiles has

Unix (which is a directory ) and it has to login to that directory , by reading
the param file but the script is getting hung

am i doing something wrong , please let me know

Thanks

Thanks , i have completed it by using While Loop

Thanks Guys