sftp login@host < /path/to/command/list
To do this safer put
export SSHPASS='your_password'
to ~/.bashrc
and run with -e
flag. I have used this cmd in some project like this: echo 'ls -t upload/*.xml' | sshpass -e sftp -oBatchMode=no -b - user@example.com | grep -v "sftp>" | head -n1