Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

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