how to ftp multiple files

Hi,

I have to write a ftp script which transfers multiple files from one unix server to another. When I try to transfer single file it goes through successfully. But, When I try to do multiple files none of the files get ftp'd. And also, even the single file goes transferred successfully, I am getting an invalid command error.

Here is the ftp scripot I am using:

#!/bin/sh
HOST='xxxxx'
USER='xxxxx'
PASSWD='xxxxxx'
FILE='/UTIL/EDI/GEN52/test_box/geiss.*'

ftp -nv $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd send
FILE='/UTIL/EDI/GEN52/test_box/geiss.*'
binary
prompt off
mput $FILE
bye
##quit
END_SCRIPT
##exit 0

Please advise how to fix this.

Thanks,
Inder

check out the "-i" option to ftp ...

Hi,

Thanks for the response!!

But isn't the -i is for disabling interactive processing. But In this case, I am not even getting a single file ftp'd.

Thanks,
Inder

i just looked at your code again and see that you're actually using a wildcard --- try specifying the files ... and yes --- i did mean to use the "-i" option ...

Try using this code:

#!/bin/sh
HOST='xxxxx'
USER='xxxxx'
PASSWD='xxxxxx'
FILE='geiss.*'

ftp -inv $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd send
lcd /UTIL/EDI/GEN52/test_box
binary
prompt off
mput $FILE
bye
##quit
END_SCRIPT
##exit 0

If an absolute source file path is specified to ftp, then it tries to put the file to the same path on the remote server. I think that's where the script is failing. (Atleast it failed for me!)