Post a reply

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

martin

Re: Here is the logging

Does the log and code correspond?
Because in the code you have "put -nopermissions -nopreservetime", while in the log both are enabled: "PrTime: Yes; ... PrR: Yes". What version of WinSCP are you using? Make sure you have the latest version.

Anyway, I recommend you to use WinSCP .NET assembly:
https://winscp.net/eng/docs/library
SWI

Here is the logging

. 2013-02-11 15:42:10.866 Startup conversation with host finished.
. 2013-02-11 15:42:10.868 Copying 1 files/directories to remote directory "/Home/framework"
. 2013-02-11 15:42:10.868 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: Yes (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask:
. 2013-02-11 15:42:10.868 TM: B; ClAr: No; CPS: 0; ExclM(No):
. 2013-02-11 15:42:10.868 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2013-02-11 15:42:10.868 File: "c:\FwNetRxInterface\OUT\Softwriters02112013142841_f0a1ff42-afe4-46b6-bf4f-b0ba020b381a.dat"
. 2013-02-11 15:42:10.869 Copying "c:\FwNetRxInterface\OUT\Softwriters02112013142841_f0a1ff42-afe4-46b6-bf4f-b0ba020b381a.dat" to remote directory started.
. 2013-02-11 15:42:10.869 Binary transfer mode selected.
. 2013-02-11 15:42:10.869 Checking existence of file.
> 2013-02-11 15:42:10.869 Type: SSH_FXP_LSTAT, Size: 91, Number: 263
< 2013-02-11 15:42:11.001 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2013-02-11 15:42:11.002 Checking existence of partially transfered file.
> 2013-02-11 15:42:11.002 Type: SSH_FXP_LSTAT, Size: 100, Number: 519
< 2013-02-11 15:42:11.163 Type: SSH_FXP_STATUS, Size: 31, Number: 519
< 2013-02-11 15:42:11.163 Status/error code: 2
. 2013-02-11 15:42:11.164 Opening remote file.
> 2013-02-11 15:42:11.164 Type: SSH_FXP_OPEN, Size: 116, Number: 771
< 2013-02-11 15:42:11.291 Type: SSH_FXP_HANDLE, Size: 13, Number: 771
> 2013-02-11 15:42:11.291 Type: SSH_FXP_WRITE, Size: 4121, Number: 1286
. 2013-02-11 15:42:12.721 27 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2013-02-11 15:42:12.721 Type: SSH_FXP_CLOSE, Size: 13, Number: 5124
< 2013-02-11 15:42:13.119 Type: SSH_FXP_STATUS, Size: 26, Number: 4614
< 2013-02-11 15:42:13.409 Type: SSH_FXP_STATUS, Size: 26, Number: 4870
< 2013-02-11 15:42:13.410 Type: SSH_FXP_STATUS, Size: 26, Number: 5124
< 2013-02-11 15:42:13.410 Status/error code: 0
> 2013-02-11 15:42:13.410 Type: SSH_FXP_REMOVE, Size: 91, Number: 5389
< 2013-02-11 15:42:13.586 Type: SSH_FXP_STATUS, Size: 26, Number: 5389
< 2013-02-11 15:42:13.586 Status/error code: 0
> 2013-02-11 15:42:13.586 Type: SSH_FXP_RENAME, Size: 186, Number: 5650
< 2013-02-11 15:42:13.730 Type: SSH_FXP_STATUS, Size: 26, Number: 5650
< 2013-02-11 15:42:13.730 Status/error code: 0
> 2013-02-11 15:42:13.730 Type: SSH_FXP_SETSTAT, Size: 107, Number: 1033
< 2013-02-11 15:42:13.816 Type: SSH_FXP_STATUS, Size: 40, Number: 1033
< 2013-02-11 15:42:13.816 Status/error code: 8, Message: 1033, Server: Operation unsupported, Language: en
* 2013-02-11 15:42:13.816 (ETerminal) The server does not support the operation.
* 2013-02-11 15:42:13.816 Error code: 8
* 2013-02-11 15:42:13.816 Error message from server (en): Operation unsupported
* 2013-02-11 15:42:13.816 Request code: 9
. 2013-02-11 15:42:13.817 Asking user:
. 2013-02-11 15:42:13.817 Upload of file 'Softwriters02112013142841_f0a1ff42-afe4-46b6-bf4f-b0ba020b381a.dat' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on 'Ignore permission errors' option. ("The server does not support the operation.
. 2013-02-11 15:42:13.817 Error code: 8
. 2013-02-11 15:42:13.817 Error message from server (en): Operation unsupported
. 2013-02-11 15:42:13.817 Request code: 9")
* 2013-02-11 15:42:13.818 (EScpSkipFile) Upload of file 'Softwriters02112013142841_f0a1ff42-afe4-46b6-bf4f-b0ba020b381a.dat' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on 'Ignore permission errors' option.
* 2013-02-11 15:42:13.818 The server does not support the operation.
* 2013-02-11 15:42:13.818 Error code: 8
* 2013-02-11 15:42:13.818 Error message from server (en): Operation unsupported
* 2013-02-11 15:42:13.818 Request code: 9
. 2013-02-11 15:42:13.819 Closing connection.
. 2013-02-11 15:42:13.819 Sending special code: 12
. 2013-02-11 15:42:13.819 Sent EOF message
SWI

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