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:
set username=micro
set password=test
set r_dir=/home/micro/output
set l_dir=c:/temp
set filename=CDR-2005-05.csv
set tempSftpScript=script.batch
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% micro@url.com
if I just run the following code:
CALL c:\cygwin\bin\sftp.exe macrolynx@url.com
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,
Teing