FTP in batch mode

HI,

Need to ftp a bunch of files in a directory in batch mode. TRying to ftp a single file first with below code.

#!/bin/ksh
function ftp_files
{
ftp -n ${D2_SRVR} <<-EOF
 quote user ${D2_UID}
 quote pass ${D2_PWD}
 cd ${D2_DIR}/${D2_NAME}
 lcd ${D1_DIR}/${D1_NAME}/dml/
 put file1
 EOF
}

but getting the syntax error

"Syntax error at line XX: '<<' unmatched.

please let me know how to run ftp in batch mode to ftp a bunch of files in a directry.

thanks

Hi

Remove the "-" in <<-EOF.

Guru

Guru,

Still getting the same error.

<<- only works with leading TABS before the closing delimiter label, not with spaces

Oops. Just noticed your closing EOF. Closing EOF should be at the beginning of the line:

#!/bin/ksh
function ftp_files
{
ftp -n ${D2_SRVR} <<EOF
 quote user ${D2_UID}
 quote pass ${D2_PWD}
 cd ${D2_DIR}/${D2_NAME}
 lcd ${D1_DIR}/${D1_NAME}/dml/
 put file1
EOF
}

Guru.

1 Like

@ guruprasadr, you only just noticed because the original post did not have code tags and so it was not visible...

Guru,

Thanks a ton for the reply.