Topic "Upload multiple files to remote server SFTP"

Author Message
vish
[View user's profile]

Joined: 2017-10-05
Posts: 2
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
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
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
[View user's profile]

Joined: 2017-10-05
Posts: 2
Actually both.

https://winscp.net/eng/docs/script_upload_file_list
From the e.g given in the above link what does files script.tmp and list.txt contains and what it does
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
The script.tmp is a temporary file generated by the batch file.
The list.txt contains list of file names.
Though I'm not sure that you need this. It looks like you just want to hard code the file names to the script.
WinSCP GUI can generate such a script file for you:
https://winscp.net/eng/docs/ui_generateurl#script

For scheduling, see:
https://winscp.net/eng/docs/guide_schedule
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License