Topic "WINSCP, SSIS, SynchronizeDirectories, Top Level Only!"

Author Message

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
Dim oWinSyncResult As SynchronizationResult
oWinSyncResult = oWinSCP.SynchronizeDirectories(SynchronizationMode.Remote, sLocalPath, sRemotePath, False, False, SynchronizationCriteria.Size)
End Using
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Please read FAQ:

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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License