I\'m using key authentication, so password is not an issue. I have a file whose name I know and I simply want to send it to another machine over sftp.
I tried searching
I know this is an old one, but you can also pass arguments to a command with a Here Document
# The following is called a HERE document
sftp @ << SOMEDELIMITER
put test.txt
... # any commands you need to execute via sftp
quit
SOMEDELIMITER
each additional command will be fed into the command preceeding the <<
and SOMEDELIMTER
can be anything you want it to be.
scp is a great option, however sftp was the only tool I was able to get working when pushing from linux to windows and you're stuck using FreeSSHD in service mode!