New to winscp and scripting

Advertisement

antoine1162
Guest

New to winscp and scripting

Hi,
As usual I have the same needs than the other ones.
I want to sync local folder with a remote one.
Everything works very well with the Synchronize button.

I have already created a scheduled task on Windows Server.
I have read many help and doc pages of WinSCP scripting.
But still I missed some clarity, it would be nice if you can help me.

I have to create a batch Windows file with the WinSCP commands in it and task scheduler will open WinSCP and call this script?
I have to create a txt file store in one place and then when WinSCP is open it will call that specific file?

And in that file I can put this informations : ( I assume that on launching WinSCP has already the user and password registered and that I don't need to put into my script, but maybe it's wrong)

set winscp=C:\WinSCP\WinSCP.com
echo option batch continue > script.tmp
echo option confirm off >> script.tmp
echo open ftp.example.com >> script.tmp
echo synchronize remote C:\local\folder /home/remote/folder >> script.tmp
echo exit >> script.tmp
%winscp% /script=script.tmp
del script.tmp
or something just like that ?
keepuptodate d:\www /home/martin/public_html

Thank you very much.
Antoine

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: New to winscp and scripting

Your script seems ok.
Though for a start it's more straightforward to use separate WinSCP script.
See also https://winscp.net/eng/docs/guide_automation

Also, you need to specify the credentials in the script. Unless the ftp.example.com refers to stored site from WinSCP GUI (what is not recommended and will hardly work anyway when combined with the Scheduler).

Reply with quote

Advertisement

You can post new topics in this forum