WINSCP, SSIS, SynchronizeDirectories, Top Level Only!

Advertisement

Guest

WINSCP, SSIS, SynchronizeDirectories, Top Level Only!

Using WIN SCP 577

I have an SSIS Script that attaches to an SFTP Site every hour and is supposed to simply synchronize a local folder with the folder of the SFTP Site.

All is working well but every now and then a user will create a sub folder on the local folder which causes an error at the SFTP site as the account being used does not have the ability to create a subfolder nor should it.

Obviously the answer I would like to tell my customer is "DON'T CREATE SUB-FOLDERS DAMNIT!" but I would rather have my SSIS Job simply monitor
the top level folder. I cannot seem to figure out how to do this.

Any ideas?

My code is:

Dim mySessionOptions As New SessionOptions
'
With mySessionOptions
.Protocol = Protocol.Sftp
.HostName = CType(Dts.Variables("sFTPSite").Value, String)
.UserName = CType(Dts.Variables("sFTPUserName").Value, String)
.Password = CType(Dts.Variables("sFTPPassWord").Value, String)
.GiveUpSecurityAndAcceptAnySshHostKey = True
End With
'
Using oWinSCP As New Session
oWinSCP.ExecutablePath = CType(Dts.Variables("ExePath").Value, String)
'
If bLogSession Then
With oWinSCP
.SessionLogPath = "AAA\INGRESS_WINSCP_LOG_BBB.TXT".Replace("AAA", sLogPath).Replace("BBB", Date.Now.ToString("MMddyy").Trim)
.DebugLogPath = "AAA\INGRESS_WINSCP_DEBUG_LOG_BBB.TXT".Replace("AAA", sLogPath).Replace("BBB", Date.Now.ToString("MMddyy").Trim)
End With
End If
'
oWinSCP.Open(mySessionOptions)
'
Dim oWinSyncResult As SynchronizationResult
'
oWinSyncResult = oWinSCP.SynchronizeDirectories(SynchronizationMode.Remote, sLocalPath, sRemotePath, False, False, SynchronizationCriteria.Size)
'
oWinSyncResult.Check()
'
oWinSCP.Close()
'
oWinSCP.Dispose()
'
End Using

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum