Topic ".NET PutFiles() Generating Exception - Uncommon File Type"

Author Message
TimeBomb006

Guest


Hi all, I'm looping through several folders and uploading each folder to a specific mapping on an SFTP server:

Code:
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():

Code:
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!
Advertisements
TimeBomb006

Guest


I'd like to add that I've just downloaded the latest library and portable executable and the issue still persists.
TimeBomb006

Guest


Also, this issue occurs with .hed, .idx, .inf, and .tad files. Don't ask me what they are, all I know is that I have to send them. Thanks again for all your help!
TimeBomb006

Guest


Please ignore. There were several orphaned WinSCP.exe processes still running from previous testing, they must have had a lock on the files I was trying. This is not a bug. I've successfully tested this functionality today.
Advertisements

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License