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.
My code is:
Dim mySessionOptions As New SessionOptions
.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
Using oWinSCP As New Session
oWinSCP.ExecutablePath = CType(Dts.Variables("ExePath").Value, String)
If bLogSession Then
.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)
Dim oWinSyncResult As SynchronizationResult
oWinSyncResult = oWinSCP.SynchronizeDirectories(SynchronizationMode.Remote, sLocalPath, sRemotePath, False, False, SynchronizationCriteria.Size)