Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Upload multiple files to remote server SFTP

Sorry, but it's not clear what is your specific problem.
So you have a problem with scheduling or with selecting the files to transfer?
vish

Upload multiple files to remote server SFTP

Hi,

Need help on understanding how to send multiple files at some regular time interval.
I was referring to Using WinSCP Scripting provided @ https://winscp.net/eng/docs/script_upload_file_list

Here I could not get what these files are and what are the contents ?
script.tmp and list.txt

example script from site
@echo off
set SESSION=sftp://user:password@example.com/
set REMOTE_PATH=/home/user/

echo open %SESSION% >> script.tmp

rem Generate "put" command for each line in list file
for /F %%i in (list.txt) do echo put "%%i" "%REMOTE_PATH%" >> script.tmp

echo exit >> script.tmp

winscp.com /script=script.tmp
set RESULT=%ERRORLEVEL%

del script.tmp

rem Propagating WinSCP exit code
exit /b %RESULT%

***********************************************************************************
My script looks like this and needs a tweak to send multiple files at regular interval

@echo off

"D:\WinSCP3\WinSCP.com" ^
/log="D:\WinSCP3\Logs\WinSCP.log" /ini=nul ^
/command ^
"open sftp://d111111:aaaa%%2A00@localhost:9222/ -hostkey=""ssh-ed25519 256 ce:b4:5d:24:94:6b:75:h0:87:57:4v:55:19:21:99:a1""" ^
"lcd C:\Users\111111\Desktop" ^
"cd /home/d111111" ^
"put -neweronly -resumesupport=10 RemoteFileTransfer.xlsx" ^
"exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)

exit /b %WINSCP_RESULT%


Thanks in advance