I want to transfer mutiple files on single sftp connection from a folder, where new files are continuously generating, through shell script.
I'm taking approach from this answer using heredocs
but failed.
Loop inside "heredoc" in shell scripting
Something like this below code
sftp -P 8922 <server> <<EOF
while [[ true ]]
do
listOfFiles=$(ls -1)
if [[ ! -z $listOfFiles ]]
then
put * /somedir
fi
done
EOF
How can i achieve this?