Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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: "Cannot close remote file" in batch mode

See documentation for list of reasons why you may be getting Error code 4.
martin

Re: "Cannot close remote file" in batch mode

Can you post "debug 2"-level log files? Or mail them to me.
cpgmr2

Re: "Cannot close remote file" in batch mode

martin wrote:

Which log file is it? The GUI one? Can you also post the other one?


The one above is from the GUI transfer. Here is the batch transfer:

. 2007-07-27 15:38:48.791 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:48.791 Detected network event
. 2007-07-27 15:38:48.862 Detected network event
. 2007-07-27 15:38:48.862 Server version: SSH-2.0-SSHD
. 2007-07-27 15:38:48.862 We claim version: SSH-2.0-WinSCP_release_4.0.3
. 2007-07-27 15:38:48.862 Using SSH protocol version 2
. 2007-07-27 15:38:48.862 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:48.922 Detected network event
. 2007-07-27 15:38:48.932 Using Diffie-Hellman with standard group "group1"
. 2007-07-27 15:38:48.932 Doing Diffie-Hellman key exchange
. 2007-07-27 15:38:48.972 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:49.412 Detected network event
. 2007-07-27 15:38:49.512 Host key fingerprint is:
. 2007-07-27 15:38:49.512 ssh-rsa 1024 8f:1b:ef:7a:4f:d0:d2:c9:bd:c5:fa:d5:f5:d1:54:8e
. 2007-07-27 15:38:49.512 Initialised Blowfish client->server encryption
. 2007-07-27 15:38:49.512 Initialised HMAC-SHA1 client->server MAC algorithm
. 2007-07-27 15:38:49.512 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:49.573 Detected network event
. 2007-07-27 15:38:49.573 Initialised Blowfish server->client encryption
. 2007-07-27 15:38:49.573 Initialised HMAC-SHA1 server->client MAC algorithm
. 2007-07-27 15:38:49.573 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:49.643 Detected network event
! 2007-07-27 15:38:49.643 Using username "********".
. 2007-07-27 15:38:49.643 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:49.703 Detected network event
! 2007-07-27 15:38:49.703 WARNING! You have accessed a private computer system. Unauthorized access, use, connection, or entry is not permitted and constitutes a crime punishable by law. We reserve the right to fully pursue criminal and civil legal penalties. All individuals using this computer network system with or without proper authority are subject to having all their activities monitored and recorded.Anyone using this system expressly consents to this monitoring. Any evidence of suspected criminal activity revealed by such monitoring may be provided to law enforcement officials. (STEE 4.1.4)
. 2007-07-27 15:38:49.703 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:49.873 Detected network event
. 2007-07-27 15:38:49.873 Session password prompt (******** password: )
. 2007-07-27 15:38:49.873 Using stored password.
. 2007-07-27 15:38:49.873 Sent password
. 2007-07-27 15:38:49.873 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:51.265 Detected network event
. 2007-07-27 15:38:51.265 Access granted
. 2007-07-27 15:38:51.265 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:51.325 Detected network event
. 2007-07-27 15:38:51.325 Opened channel for session
. 2007-07-27 15:38:51.325 Waiting for the server to continue with the initialisation
. 2007-07-27 15:38:52.026 Detected network event
. 2007-07-27 15:38:52.026 Started a shell/command
. 2007-07-27 15:38:52.026 --------------------------------------------------------------------------
. 2007-07-27 15:38:52.026 Using SFTP protocol.
. 2007-07-27 15:38:52.166 Doing startup conversation with host.
> 2007-07-27 15:38:52.176 Type: SSH_FXP_INIT, Size: 5, Number: -1
. 2007-07-27 15:38:52.176 Sent 9 bytes
. 2007-07-27 15:38:52.176 There are 9 bytes remaining in the send buffer
. 2007-07-27 15:38:52.176 Waiting for another 4 bytes
. 2007-07-27 15:38:52.287 Detected network event
. 2007-07-27 15:38:52.297 Waiting for another 4 bytes
. 2007-07-27 15:38:52.357 Detected network event
. 2007-07-27 15:38:52.357 Received 9 bytes (0)
. 2007-07-27 15:38:52.357 Read 4 bytes (5 pending)
. 2007-07-27 15:38:52.357 Read 5 bytes (0 pending)
< 2007-07-27 15:38:52.357 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2007-07-27 15:38:52.357 SFTP version 3 negotiated.
. 2007-07-27 15:38:52.357 We believe the server has signed timestamps bug
. 2007-07-27 15:38:52.357 We will use UTF-8 strings for status messages only
. 2007-07-27 15:38:52.357 Getting current directory name.
. 2007-07-27 15:38:52.357 Getting real path for '.'
> 2007-07-27 15:38:52.357 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
. 2007-07-27 15:38:52.357 Sent 14 bytes
. 2007-07-27 15:38:52.357 There are 0 bytes remaining in the send buffer
. 2007-07-27 15:38:52.357 Waiting for another 4 bytes
. 2007-07-27 15:38:53.458 Detected network event
. 2007-07-27 15:38:53.458 Received 47 bytes (0)
. 2007-07-27 15:38:53.458 Read 4 bytes (43 pending)
. 2007-07-27 15:38:53.458 Read 43 bytes (0 pending)
< 2007-07-27 15:38:53.458 Type: SSH_FXP_NAME, Size: 43, Number: 16
. 2007-07-27 15:38:53.458 Real path is '/'
. 2007-07-27 15:38:53.458 Startup conversation with host finished.
. 2007-07-27 15:38:53.478 Cached directory change via "/outbound" to "/outbound".
. 2007-07-27 15:38:53.488 Getting current directory name.
. 2007-07-27 15:38:53.488 Copying 1 files/directories to remote directory "/outbound"
. 2007-07-27 15:38:53.488 PrTime: No; PrRO: Yes; Rght: rw-r--r--; PrR: No (Yes); FnCs: N; RIC: 00; Resume: S (102400); CalcS: No; Mask:
. 2007-07-27 15:38:53.488 TM: A; ClAr: No; ExclM(No):
. 2007-07-27 15:38:53.488 AscM: *.*html; *.htm; *.txt; *.php*; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2007-07-27 15:38:53.488 File: "\\ftp\as400\PosPay\ARPppay.txt"
. 2007-07-27 15:38:53.508 Copying "\\ftp\as400\PosPay\ARPppay.txt" to remote directory started.
. 2007-07-27 15:38:53.508 Ascii transfer mode selected.
. 2007-07-27 15:38:53.508 Opening remote file.
> 2007-07-27 15:38:53.518 Type: SSH_FXP_OPEN, Size: 46, Number: 259
. 2007-07-27 15:38:53.518 Sent 50 bytes
. 2007-07-27 15:38:53.518 There are 0 bytes remaining in the send buffer
. 2007-07-27 15:38:53.518 Waiting for another 4 bytes
. 2007-07-27 15:38:54.750 Detected network event
. 2007-07-27 15:38:54.750 Received 14 bytes (0)
. 2007-07-27 15:38:54.750 Read 4 bytes (10 pending)
. 2007-07-27 15:38:54.750 Read 10 bytes (0 pending)
< 2007-07-27 15:38:54.750 Type: SSH_FXP_HANDLE, Size: 10, Number: 259
> 2007-07-27 15:38:54.750 Type: SSH_FXP_WRITE, Size: 4118, Number: 774
. 2007-07-27 15:38:54.760 Sent 4122 bytes
. 2007-07-27 15:38:54.760 There are 0 bytes remaining in the send buffer
> 2007-07-27 15:38:54.760 Type: SSH_FXP_WRITE, Size: 288, Number: 1030
. 2007-07-27 15:38:54.760 Sent 292 bytes
. 2007-07-27 15:38:54.760 There are 0 bytes remaining in the send buffer
> 2007-07-27 15:38:54.760 Type: SSH_FXP_CLOSE, Size: 10, Number: 1284
. 2007-07-27 15:38:54.760 Sent 14 bytes
. 2007-07-27 15:38:54.760 There are 0 bytes remaining in the send buffer
. 2007-07-27 15:38:54.760 Waiting for another 4 bytes
. 2007-07-27 15:38:55.301 Detected network event
. 2007-07-27 15:38:55.301 Received 53 bytes (0)
. 2007-07-27 15:38:55.301 Read 4 bytes (49 pending)
. 2007-07-27 15:38:55.301 Read 49 bytes (0 pending)
< 2007-07-27 15:38:55.301 Type: SSH_FXP_STATUS, Size: 49, Number: 774
. 2007-07-27 15:38:55.301 Waiting for another 4 bytes
. 2007-07-27 15:38:55.491 Detected network event
. 2007-07-27 15:38:55.491 Received 53 bytes (0)
. 2007-07-27 15:38:55.491 Received 83 bytes (0)
. 2007-07-27 15:38:55.491 Read 4 bytes (132 pending)
. 2007-07-27 15:38:55.491 Read 49 bytes (83 pending)
< 2007-07-27 15:38:55.491 Type: SSH_FXP_STATUS, Size: 49, Number: 1030
. 2007-07-27 15:38:55.491 Read 4 bytes (79 pending)
. 2007-07-27 15:38:55.491 Read 79 bytes (0 pending)
< 2007-07-27 15:38:55.491 Type: SSH_FXP_STATUS, Size: 79, Number: 1284
< 2007-07-27 15:38:55.491 Status/error code: 4, Message: 1284, Server: I/O Error: Failure agent exit code -1 when closing the stream., Language:
* 2007-07-27 15:38:55.491 (ETerminal) General failure (server should provide error description).
* 2007-07-27 15:38:55.491 Error code: 4
* 2007-07-27 15:38:55.491 Error message from server: I/O Error: Failure agent exit code -1 when closing the stream.
* 2007-07-27 15:38:55.491 Request code: 4
. 2007-07-27 15:38:55.491 Asking user:
. 2007-07-27 15:38:55.491 Cannot close remote file 'ARPppay.txt'. ("General failure (server should provide error description).
. 2007-07-27 15:38:55.491 Error code: 4
. 2007-07-27 15:38:55.491 Error message from server: I/O Error: Failure agent exit code -1 when closing the stream.
. 2007-07-27 15:38:55.491 Request code: 4")
* 2007-07-27 15:38:55.501 (EScpSkipFile) Cannot close remote file 'ARPppay.txt'.
* 2007-07-27 15:38:55.501 General failure (server should provide error description).
* 2007-07-27 15:38:55.501 Error code: 4
* 2007-07-27 15:38:55.501 Error message from server: I/O Error: Failure agent exit code -1 when closing the stream.
* 2007-07-27 15:38:55.501 Request code: 4
. 2007-07-27 15:38:55.501 Closing connection.
martin

Re: "Cannot close remote file" in batch mode

Which log file is it? The GUI one? Can you also post the other one?
cpgmr2

Re: "Cannot close remote file" in batch mode

martin wrote:

It is probably caused by that. But I do not understand why it works in GUI. Can you post a log file both for GUI and script?


Here's the relevent part of the log. I manually deleted the file after copying it.

One difference is that in the GUI I'm using a mapped network drive "F:", but in the batch process I'm using UNC notation \\FTP\PosPay\ARPppay.txt.

. 2007-07-27 10:22:44.033 Session upkeep
. 2007-07-27 10:22:44.534 Session upkeep
. 2007-07-27 10:22:44.724 Copying 1 files/directories to remote directory "/"
. 2007-07-27 10:22:44.724 PrTime: No; PrRO: Yes; Rght: rw-r--r--; PrR: No (Yes); FnCs: N; RIC: 00; Resume: S (102400); CalcS: No; Mask: *.*
. 2007-07-27 10:22:44.734 TM: M; ClAr: No; ExclM(No):
. 2007-07-27 10:22:44.734 AscM: *.*html; *.htm; *.txt; *.php*; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2007-07-27 10:22:44.734 File: "F:\PosPay\ARPppay.txt"
. 2007-07-27 10:22:44.754 Copying "F:\PosPay\ARPppay.txt" to remote directory started.
. 2007-07-27 10:22:44.754 Ascii transfer mode selected.
. 2007-07-27 10:22:44.754 Opening remote file.
> 2007-07-27 10:22:44.764 Type: SSH_FXP_OPEN, Size: 37, Number: 1283
. 2007-07-27 10:22:44.764 Sent 41 bytes
. 2007-07-27 10:22:44.764 There are 0 bytes remaining in the send buffer
. 2007-07-27 10:22:44.764 Read 4 bytes (40 pending)
. 2007-07-27 10:22:44.764 Read 40 bytes (0 pending)
< 2007-07-27 10:22:44.764 Type: SSH_FXP_STATUS, Size: 40, Number: 1028
. 2007-07-27 10:22:44.764 Discarding reserved response
. 2007-07-27 10:22:44.764 Waiting for another 4 bytes
. 2007-07-27 10:22:45.966 Detected network event
. 2007-07-27 10:22:45.966 Received 14 bytes (0)
. 2007-07-27 10:22:45.966 Read 4 bytes (10 pending)
. 2007-07-27 10:22:45.966 Read 10 bytes (0 pending)
< 2007-07-27 10:22:45.966 Type: SSH_FXP_HANDLE, Size: 10, Number: 1283
. 2007-07-27 10:22:45.976 Session upkeep
> 2007-07-27 10:22:45.976 Type: SSH_FXP_WRITE, Size: 4118, Number: 1798
. 2007-07-27 10:22:45.976 Sent 4122 bytes
. 2007-07-27 10:22:45.976 There are 0 bytes remaining in the send buffer
> 2007-07-27 10:22:45.976 Type: SSH_FXP_WRITE, Size: 288, Number: 2054
. 2007-07-27 10:22:45.976 Sent 292 bytes
. 2007-07-27 10:22:45.976 There are 0 bytes remaining in the send buffer
> 2007-07-27 10:22:45.976 Type: SSH_FXP_CLOSE, Size: 10, Number: 2308
. 2007-07-27 10:22:45.976 Sent 14 bytes
. 2007-07-27 10:22:45.976 There are 0 bytes remaining in the send buffer
. 2007-07-27 10:22:45.976 Waiting for another 4 bytes
. 2007-07-27 10:22:46.697 Detected network event
. 2007-07-27 10:22:46.697 Received 53 bytes (0)
. 2007-07-27 10:22:46.697 Read 4 bytes (49 pending)
. 2007-07-27 10:22:46.697 Read 49 bytes (0 pending)
< 2007-07-27 10:22:46.697 Type: SSH_FXP_STATUS, Size: 49, Number: 1798
. 2007-07-27 10:22:46.697 Waiting for another 4 bytes
. 2007-07-27 10:22:46.887 Detected network event
. 2007-07-27 10:22:46.887 Received 53 bytes (0)
. 2007-07-27 10:22:46.887 Received 44 bytes (0)
. 2007-07-27 10:22:46.887 Read 4 bytes (93 pending)
. 2007-07-27 10:22:46.887 Read 49 bytes (44 pending)
< 2007-07-27 10:22:46.887 Type: SSH_FXP_STATUS, Size: 49, Number: 2054
. 2007-07-27 10:22:46.887 Read 4 bytes (40 pending)
. 2007-07-27 10:22:46.887 Read 40 bytes (0 pending)
< 2007-07-27 10:22:46.887 Type: SSH_FXP_STATUS, Size: 40, Number: 2308
< 2007-07-27 10:22:46.887 Status/error code: 0
. 2007-07-27 10:22:46.887 Session upkeep
. 2007-07-27 10:22:46.887 Listing directory "/".
> 2007-07-27 10:22:46.887 Type: SSH_FXP_OPENDIR, Size: 10, Number: 2571
. 2007-07-27 10:22:46.887 Sent 14 bytes
. 2007-07-27 10:22:46.887 There are 0 bytes remaining in the send buffer
. 2007-07-27 10:22:46.887 Waiting for another 4 bytes
. 2007-07-27 10:22:47.308 Detected network event
. 2007-07-27 10:22:47.308 Received 14 bytes (0)
. 2007-07-27 10:22:47.308 Read 4 bytes (10 pending)
. 2007-07-27 10:22:47.308 Read 10 bytes (0 pending)
< 2007-07-27 10:22:47.308 Type: SSH_FXP_HANDLE, Size: 10, Number: 2571
> 2007-07-27 10:22:47.308 Type: SSH_FXP_READDIR, Size: 10, Number: 2828
. 2007-07-27 10:22:47.308 Sent 14 bytes
. 2007-07-27 10:22:47.308 There are 0 bytes remaining in the send buffer
. 2007-07-27 10:22:47.308 Waiting for another 4 bytes
. 2007-07-27 10:22:47.368 Detected network event
. 2007-07-27 10:22:47.368 Received 410 bytes (0)
. 2007-07-27 10:22:47.368 Read 4 bytes (406 pending)
. 2007-07-27 10:22:47.368 Read 406 bytes (0 pending)
< 2007-07-27 10:22:47.368 Type: SSH_FXP_NAME, Size: 406, Number: 2828
> 2007-07-27 10:22:47.368 Type: SSH_FXP_READDIR, Size: 10, Number: 3084
. 2007-07-27 10:22:47.368 Sent 14 bytes
. 2007-07-27 10:22:47.368 There are 0 bytes remaining in the send buffer
. 2007-07-27 10:22:47.368 Waiting for another 4 bytes
. 2007-07-27 10:22:47.438 Detected network event
. 2007-07-27 10:22:47.438 Received 21 bytes (0)
. 2007-07-27 10:22:47.438 Read 4 bytes (17 pending)
. 2007-07-27 10:22:47.438 Read 17 bytes (0 pending)
< 2007-07-27 10:22:47.438 Type: SSH_FXP_STATUS, Size: 17, Number: 3084
< 2007-07-27 10:22:47.438 Status/error code: 1
> 2007-07-27 10:22:47.438 Type: SSH_FXP_CLOSE, Size: 10, Number: 3332
. 2007-07-27 10:22:47.438 Sent 14 bytes
. 2007-07-27 10:22:47.438 There are 0 bytes remaining in the send buffer
. 2007-07-27 10:22:47.468 Session upkeep
. 2007-07-27 10:22:47.548 Session upkeep
. 2007-07-27 10:22:47.548 Detected network event
. 2007-07-27 10:22:47.548 Received 44 bytes (0)
. 2007-07-27 10:22:48.039 Session upkeep
. 2007-07-27 10:22:48.540 Session upkeep
. 2007-07-27 10:23:00.557 Session upkeep
. 2007-07-27 10:23:01.058 Session upkeep
. 2007-07-27 10:23:01.359 Deleting file "ARPppay.txt_102246.RECVD".
> 2007-07-27 10:23:01.359 Type: SSH_FXP_REMOVE, Size: 34, Number: 3597
martin

Re: "Cannot close remote file" in batch mode

It is probably caused by that. But I do not understand why it works in GUI. Can you post a log file both for GUI and script?
cpgmr2

"Cannot close remote file" in batch mode

Version 4.0.3, SFTP-3
When I drag the file manually in WinSCP it works fine. When I use a PUT in batch mode I get this log:

Session started.
Active session: [1] WF_PositivePay
/outbound
transfer ascii
\...\PosPay\ARPppay.txt | 4 kB | 1.6 kB/s | ascii | 100%
Cannot close remote file 'ARPppay.txt'.
General failure (server should provide error description).
Error code: 4
Error message from server: I/O Error: Failure agent exit code -1 when closing the stream.
Request code: 4
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
Session 'WF_PositivePay' closed.

The receiving server renames the file, adding "_hhmmss.RECVD" to the end. I turned off Set Permissions and Preserve Timestamp, Ignore Permission Errors is on.

Is there anything I can do on my end to resolve this, or is this caused by the server renaming the file?