I want to run a batch file which can connect automatically to SFTP Server running on Linux and can download files from Linux remote side to my local side. Besides that, this file will be scheduled to run automatically on every month. But, I'm facing a problem to connect it automatically? Below is one of my example of testing it:
echo user %username%_%password%>>%tempSftpScript%
echo cd %r_dir%>>%tempSftpScript%
echo lcd %l_dir%>>%tempSftpScript%
echo get %filename%>>%tempSftpScript%
rem echo bye>>%tempSftpScript%
CALL c:\cygwin\bin\sftp.exe -b:%tempSftpScript% email@example.com
if I just run the following code:
CALL c:\cygwin\bin\sftp.exe firstname.lastname@example.org
Then, it can connect automatically but also need to enter password manually.
Is there any way to connect to SFTP and download file automatically from Linux?
Your reply will be appreciated.
Thank You in advance,