Hi all, I'm looping through several folders and uploading each folder to a specific mapping on an SFTP server:
If operationType = "FTPUpload" Then
For Each folderName As String In Directory.GetDirectories(_unzippedPath)
Dim folder As New DirectoryInfo(folderName)
If folder.Name = "g0067905" Then
remotePath = "/Test/07 Dentifrice/"
ElseIf folder.Name = "c0156915" Then
remotePath = "/Test/"
ElseIf folder.Name = "c1211905" Then
remotePath = "/Test/"
ElseIf folder.Name = "c1160905" Then
remotePath = "/Test/"
ElseIf folder.Name = "c1841905" Then
remotePath = "/Test/New_NS/"
ElseIf folder.Name = "c0471905" Then
remotePath = "/Test/NewFACECARE06/"
ElseIf folder.Name = "c1340905" Then
remotePath = "/Test/"
Else
Throw New Exception("Invalid folder name! No path mapping found for " & folderName)
End If
For Each fileName As String In Directory.GetFiles(folderName)
transferResult = session.PutFiles(fileName, remotePath, False, transferOptions)
transferResult.Check()
For Each transfer In transferResult.Transfers
AppSettings.log.Info(transfer.FileName & " uploaded successfully.")
Next
Next
Next
This works well for the first couple files in the folder, which are .doc and .xml files, but then it reaches a file with an extension .chr and generates the following on transferResult.Check():
Error transferring file 'C:\Test\Unzipped\c0156915\c0156915.chr'.
Initially, I thought that it might have trouble overwriting files, but I know that the .doc and .xml files have been overwriting successfully.
I realize that it's probably the file extension that's causing the issue. I've tried setting the transferOptions.TransferMode to Binary and Automatic, but neither has provided a workaround.
Is there anything else I can provide that would make debugging this easier? Am I just doing something incorrectly?
Thanks!