vbs SynchronizeDirectories SynchronizationMode_Remote doesn't work

Advertisement

RS2000
Joined:
Posts:
2
Location:
FRANCE

vbs SynchronizeDirectories SynchronizationMode_Remote doesn't work

Hi,
I'm scripting in vbs and when i execute the code:

Dim transferOptions, synchronizationResult
Set transferOptions = WScript.CreateObject("WinSCP.TransferOptions")
transferOptions.TransferMode = TransferMode_Binary
transferOptions.FileMask = "|1 - Plan masse/; 2 - Niveaux/; 4 - DWG/; 5 - Facades/; 6 - Autres/; Thumbs.db; .DS_Store"
Set synchronizationResult = session.SynchronizeDirectories( SynchronizationMode_Remote , "E:\HOME\Groupes\PLANS\0000 exemple\3 - Logements\", REP_DISTANT & "/Groupes/PLANS/0000 exemple/3 - Logements/", false, false, SynchronizationCriteria_Either, transferOptions )

The SynchronizationMode is Local and not Remote.
I've the same problem with SynchronizationCriteria_Either, it doesn't work

I don't know why, someone have an idea ?
Thank you very much

Reply with quote

Advertisement

RS2000
Joined:
Posts:
2
Location:
FRANCE

Re: vbs SynchronizeDirectories SynchronizationMode_Remote doesn't work

martin wrote:

Is your script in WSF file with WinSCP.Session reference?
https://winscp.net/eng/docs/library_com_wsh#enums
Yes, my script is a .vbs
and i've a Winscp.session
Dim sessionOptions
Set sessionOptions = WScript.CreateObject("WinSCP.SessionOptions")
With sessionOptions
    .Protocol = Protocol_Sftp
    .HostName = "xxx.xxx.xxx.xxx"
    .PortNumber = 22
    .UserName = "login"
    .Password = "passwd"
    .SshHostKeyFingerprint = "key"
End With
 
 
Dim session
Set session = WScript.CreateObject("WinSCP.Session")
session.SessionLogPath = REP_LOG & "scplog" & "_" & TimeStamp & ".log"
session.DebugLogPath = REP_LOG & "scpdebug" & "_" & TimeStamp & ".log"
 
 
session.Open sessionOptions
 
Dim transferOptions, synchronizationResult
Set transferOptions = WScript.CreateObject("WinSCP.TransferOptions")
transferOptions.TransferMode = TransferMode_Binary
transferOptions.FileMask = "|1 - Plan masse/; 2 - Niveaux/; 4 - DWG/; 5 - Facades/; 6 - Autres/; Thumbs.db; .DS_Store"
 
Set synchronizationResult = session.SynchronizeDirectories( SynchronizationMode_Remote , "E:\HOME\Groupes\PLANS\0000 exemple\3 - Logements\", REP_DISTANT & "/Groupes/PLANS/0000 exemple/3 - Logements/", false, false, SynchronizationCriteria_Either, transferOptions )

The synchronization is done, but in the wrong direction
in the debug i've:
<group name="synchronize local -nopermissions -preservetime -transfer=&quot;binary&quot; -filemask=&quot;|1 - Plan masse/; 2 - Niveaux/; 4 - DWG/; 5 - Facades/; 6 - Autres/; Thumbs.db; .DS_Store&quot; -criteria=&quot;none&quot; -- &quot;E:\HOME\Groupes\PLANS\0000 exemple\3 - Logements\&quot; &quot;/home/esdom-extranet/public_html/Groupes/PLANS/0000 exemple/3 - Logements/&quot;" start="2020-07-24T07:11:04.603Z">

thanks for your answer.

Reply with quote

martin
Site Admin
martin avatar

Re: vbs SynchronizeDirectories SynchronizationMode_Remote doesn't work

Not .vbs. It has to be .wsf. Please read the linked documentation.

Reply with quote

Guest

Re: vbs SynchronizeDirectories SynchronizationMode_Remote doesn't work

martin wrote:

Not .vbs. It has to be .wsf. Please read the linked documentation.

I just added:

<job>
<reference object="WinSCP.Session" />
<script language="VBScript">
 
</script>
</job>
and renamed .vbs in .wsh

AND it works fine, you saved me, thank you very much.

Reply with quote

Advertisement

You can post new topics in this forum