Topic "Automatic Synchronitzation"

Author Message
Maik

Guest


It's possible to create a Scheduled task to make a daily synchronitzation between two servers. Can I call the soft via cmd?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
PLEASE, take a time and read documentation before asking!
Guest




Maik wrote:
It's possible to create a Scheduled task to make a daily synchronitzation between two servers. Can I call the soft via cmd?


It took some time to figure the best way out.
Install WinSCP en make a connection to the Unix server to receive the hash keys.
Copy the keys to the profile of the account which runs the scheduler or copy them to the default profile.

Then you can use the following vbs script and bat script. Call the vbs from the scheduler and it synchronise the local folder with the remote one.
You can moify the script is an other synchonisation way is needed.
Note: if you use linked files on the Unix server which shows a small file, but are big files in size, the data transfer drops to 30Kb/s.


anyname.VBS
---------------------------------------------------------------------------------------
Const BatchFilePath = "C:\batch\"
Const WinSCPAppPath = "C:\Progra~1\WinSCP3\winscp3.com"
Const ConnectionUserName = "username"
Const ConnectionPassword = "password"
Const WinSCPParam = " option confirm off /script="

Dim shell : Set shell = wscript.CreateObject("WScript.Shell")
Dim objFSO : set objFSO = createObject("scripting.filesystemObject")
Dim objNet : Set objNet = CreateObject("wscript.network")
Dim ArgObj : Set ArgObj = WScript.Arguments
Dim CommandLine

ServerName = ArgObj(0)
ScriptName = "scriptname.bat"

Set textFile = objFSO.OpentextFile("C:\Synchonizelog.txt",2 ,true)

TextFile.writeLine("Start" & " " & Now & " By " & objNet.UserName)

CommandLine = WinSCPAppPath & " " & ConnectionUserName & ":" & ConnectionPassword & "@" & ServerName & WinSCPParam & BatchFilePath & ScriptName

shell.Run CommandLine,0 ,true

TextFile.writeLine("Finished" & " " & Now)

textfile.close

set ArgObj = Nothing
set objNet = Nothing
set objFSO = nothing
set shell = nothing
---------------------------------------------------------------------------------------

scriptname.BAT
---------------------------------------------------------------------------------------
option confirm off
synchronize local C:\logfiles\folder /application/logs/
close
exit
---------------------------------------------------------------------------------------
Advertisements

You can post new topics in this forum






Search Site

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