Upload of file was successful but error occurred
I have been attempting to automate an SFTP transfer through .NET using the shell but I continue to get the highly publicized error: "Upload of File 'filename' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on 'Ignore permissions errors' option."
I receive the same error when I use the double pane GUI. I have set the Ignore Permission Errors both ways, set permissions to 777 tried taking off the preserve timestamp all with no resolution. We use this same process with many other applications and have never had this issue. I have tried all the "fixes" on the web but they have not resolved the issue. Does anyone know how to get around this error. Here is the code that is sending the file:
Try
Dim procSFTP As New Process
procSFTP.StartInfo.FileName = My.Settings.SFTPApp
If Len(Trim(My.Settings.SFTPLogFile)) > 0 Then
procSFTP.StartInfo.Arguments = String.Format("/log=""{0}""", My.Settings.SFTPLogFile)
End If
procSFTP.StartInfo.RedirectStandardInput = True
procSFTP.StartInfo.UseShellExecute = False
procSFTP.StartInfo.CreateNoWindow = True
procSFTP.Start()
procSFTP.StandardInput.WriteLine("option batch on")
procSFTP.StandardInput.WriteLine("option confirm off")
procSFTP.StandardInput.WriteLine(String.Format("open {0}:{1}@{2} -hostkey=""{3}""", userID, password, server, hostkey))
procSFTP.StandardInput.WriteLine("option transfer binary")
If Len(Trim(My.Settings.RemoteDir)) > 0 Then
procSFTP.StandardInput.WriteLine(String.Format("cd {0}", My.Settings.RemoteDir))
End If
procSFTP.StandardInput.WriteLine(String.Format("put -nopermissions -nopreservetime ""{0}""", fileName))
procSFTP.StandardInput.WriteLine("close")
procSFTP.StandardInput.WriteLine("exit")
procSFTP.StandardInput.Close()
procSFTP.WaitForExit()
If procSFTP.ExitCode = 0 Then
transferred = True
End If
procSFTP.Close()
Catch ex As Exception
My.Application.Log.WriteEntry("Error occurred when sending file " & fileName & " via SFTP:" & vbCrLf & ex.Message, TraceEventType.Error)
Exit Sub
End Try
I receive the same error when I use the double pane GUI. I have set the Ignore Permission Errors both ways, set permissions to 777 tried taking off the preserve timestamp all with no resolution. We use this same process with many other applications and have never had this issue. I have tried all the "fixes" on the web but they have not resolved the issue. Does anyone know how to get around this error. Here is the code that is sending the file:
Try
Dim procSFTP As New Process
procSFTP.StartInfo.FileName = My.Settings.SFTPApp
If Len(Trim(My.Settings.SFTPLogFile)) > 0 Then
procSFTP.StartInfo.Arguments = String.Format("/log=""{0}""", My.Settings.SFTPLogFile)
End If
procSFTP.StartInfo.RedirectStandardInput = True
procSFTP.StartInfo.UseShellExecute = False
procSFTP.StartInfo.CreateNoWindow = True
procSFTP.Start()
procSFTP.StandardInput.WriteLine("option batch on")
procSFTP.StandardInput.WriteLine("option confirm off")
procSFTP.StandardInput.WriteLine(String.Format("open {0}:{1}@{2} -hostkey=""{3}""", userID, password, server, hostkey))
procSFTP.StandardInput.WriteLine("option transfer binary")
If Len(Trim(My.Settings.RemoteDir)) > 0 Then
procSFTP.StandardInput.WriteLine(String.Format("cd {0}", My.Settings.RemoteDir))
End If
procSFTP.StandardInput.WriteLine(String.Format("put -nopermissions -nopreservetime ""{0}""", fileName))
procSFTP.StandardInput.WriteLine("close")
procSFTP.StandardInput.WriteLine("exit")
procSFTP.StandardInput.Close()
procSFTP.WaitForExit()
If procSFTP.ExitCode = 0 Then
transferred = True
End If
procSFTP.Close()
Catch ex As Exception
My.Application.Log.WriteEntry("Error occurred when sending file " & fileName & " via SFTP:" & vbCrLf & ex.Message, TraceEventType.Error)
Exit Sub
End Try