Convert SSH portion to SFTP

I just discovered that my company cant use ssh because they have so wack way of retrieving files without using key-authication.

I need to convert a portion of my script form ssh to sftp.

Here I am logginginto the machine to print a list of files.

while read line; do
	host=$line
	ssh $user@$host ls -l $directory $src_file_name$param'*' > ftpList$i.txt

I need to convert that to sftp. How do I do that?

Try using a batch mode script like this:

echo 'ls -l $directory $src_file_name$param*' > cmd_file
while read line; do
	host=$line
	sftp -b cmd_file $user@$host > ftpList$i.txt

This is an example of a inline sftp in shell script:

#!/bin/ksh
# test_sftp.sh
sftp -b /dev/stdin -v -o BatchMode=yes -o IdentityFile=/export/home/user/.ssh/id_rsa -o Port=22 user@host <<ENDSFTP
cd /home/user/test
put /export/home/user/test/test.txt test.txt.xferring
rename test.txt.xferring test.txt
quit
ENDSFTP
rc=$?
if [[ $rc != 0 ]]    then
    print "Error occured...$rc" `date "+%Y-%m-%d-%H.%M.%S"`
else
 print "Successful transfer...$rc" `date "+%Y-%m-%d-%H.%M.%S"`
fi