Empty file downloaded

Advertisement

kraak
Joined:
Posts:
2

Empty file downloaded

Hi there, I'm having an issue with downloading text files from an ftp server. Multiple times a day I upload files to a certain folder called outbound. From this folder a different user runs a script (see below) that downloads all these files with 30 min. intervals. After it has downloaded all files, it moves the files to a folder outbound/archive on the ftp. The script runs on Windows 2008 Server with WinSCP version 5.7.2 build 5316.

Command line:
"PathToWinSCP\winscp.exe" /script=PathToScript\Script.txt /xmllog=PathToLog\LogFTP.xml
Script:
option batch abort
option confirm off
open ftp://<ftpurl> 
cd /outbound
option transfer binary
get foo*.txt e:\downloads\
mv foo*.txt /outbound/archive/
close
exit
This all seemed to work great, except for the last two weeks in which we encountered twice the issue that a file was downloaded as a 0 bytes file. However, looking back at these files in the outbound/archive folder they did contain data.

So now the question remains how this is possible. At first I thought that maybe the script tried to download the file while it was still being written. However, another file that was uploaded after the 'empty' file, was downloaded correctly. So that scenario does not seem very likely.

I've attached the only logs that I could retrieve, not sure whether there should be more extensive ones.

Does anybody else have an idea for a possible reason? Should I try a more extensive script to only download the file when it is not empty and also only move the file in that case?

I hope you can help!

Reply with quote

Advertisement

kraak

Re: Empty file downloaded

Thanks for your reply. I don't think the other user had turned this logging on, or is that not possible? Anyway I'll try to recreate the issue myself.

Reply with quote

isralennon
Joined:
Posts:
2
Location:
OC, CA

I have the same problem - Here is my Log file

Looks like I have the exact same problem both using automation and the UI.

The error says the server rejected command "CWD". I'm unfamiliar with this command.

Here is the log file contents. I have masked my FTP server and user, for obvious reasons but we can see the error as it occurred
. 2017-03-14 10:13:16.608 --------------------------------------------------------------------------
. 2017-03-14 10:13:16.608 WinSCP Version 5.9.4 (Build 7333) (OS 6.3.9600 - Windows 8.1 Enterprise)
. 2017-03-14 10:13:16.608 Configuration: nul
. 2017-03-14 10:13:16.608 Log level: Normal
. 2017-03-14 10:13:16.608 Local account: URBANSCIENCENET\iromero
. 2017-03-14 10:13:16.608 Working directory: L:\MyDirectory
. 2017-03-14 10:13:16.608 Process ID: 6732
. 2017-03-14 10:13:16.608 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe"  /log="L:\OtherDirectory\WinSCP.log" /ini=nul /script="L:\BatchDirectory\Instructions.txt"
. 2017-03-14 10:13:16.608 Time zone: Current: GMT-7, Standard: GMT-8 (Pacific Standard Time), DST: GMT-7 (Pacific Daylight Time), DST Start: 3/12/2017, DST End: 11/5/2017
. 2017-03-14 10:13:16.608 Login time: Tuesday, March 14, 2017 10:13:16 AM
. 2017-03-14 10:13:16.608 --------------------------------------------------------------------------
. 2017-03-14 10:13:16.608 Script: Retrospectively logging previous script records:
> 2017-03-14 10:13:16.608 Script: open ftp://MyUser:***@my.server.com/
. 2017-03-14 10:13:16.608 --------------------------------------------------------------------------
. 2017-03-14 10:13:16.608 Session name: MyUser@my.server.com (Ad-Hoc site)
. 2017-03-14 10:13:16.608 Host name: my.server.com (Port: 21)
. 2017-03-14 10:13:16.608 User name: MyUser (Password: Yes, Key file: No, Passphrase: No)
. 2017-03-14 10:13:16.608 Transfer Protocol: FTP
. 2017-03-14 10:13:16.608 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2017-03-14 10:13:16.608 Disable Nagle: No
. 2017-03-14 10:13:16.608 Proxy: None
. 2017-03-14 10:13:16.608 Send buffer: 262144
. 2017-03-14 10:13:16.608 UTF: Auto
. 2017-03-14 10:13:16.608 FTPS: None [Client certificate: No]
. 2017-03-14 10:13:16.608 FTP: Passive: Yes [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2017-03-14 10:13:16.608 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2017-03-14 10:13:16.608 Cache directory changes: Yes, Permanent: Yes
. 2017-03-14 10:13:16.608 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2017-03-14 10:13:16.624 Timezone offset: 0h 0m
. 2017-03-14 10:13:16.624 --------------------------------------------------------------------------
. 2017-03-14 10:13:16.624 Connecting to my.server.com ...
. 2017-03-14 10:13:16.702 Connected with my.server.com. Waiting for welcome message...
< 2017-03-14 10:13:16.937 220-FTPNET1 IBM FTP CS V1R13 at host.MYSERVER.COM, 17:13:21 on 2017-03-14.
< 2017-03-14 10:13:16.937 220 Connection will close if idle for more than 5 minutes.
> 2017-03-14 10:13:16.937 USER MyUser
< 2017-03-14 10:13:17.077 331 Send password please.
> 2017-03-14 10:13:17.077 PASS ****
< 2017-03-14 10:13:17.312 230 MyUser is logged on.  Working directory is "MyUser.".
> 2017-03-14 10:13:17.312 SYST
. 2017-03-14 10:13:17.452 Server is known not to support LIST -a
< 2017-03-14 10:13:17.452 215 MVS is the operating system of this server. FTP Server is running on z/OS.
> 2017-03-14 10:13:17.452 FEAT
< 2017-03-14 10:13:17.593 211 no Extensions supported
. 2017-03-14 10:13:17.593 Connected
. 2017-03-14 10:13:17.593 --------------------------------------------------------------------------
. 2017-03-14 10:13:17.593 Using FTP protocol.
. 2017-03-14 10:13:17.593 Doing startup conversation with host.
> 2017-03-14 10:13:17.593 PWD
< 2017-03-14 10:13:17.733 257 "'MyUser.'" is working directory.
. 2017-03-14 10:13:17.733 Getting current directory name.
. 2017-03-14 10:13:17.733 Startup conversation with host finished.
< 2017-03-14 10:13:17.749 Script: Active session: [1] MyUser@my.server.com
> 2017-03-14 10:13:17.749 Script: cd /'MyUser.'
. 2017-03-14 10:13:17.749 Changing directory to "/'MyUser.'".
> 2017-03-14 10:13:17.749 CWD /'MyUser.'
< 2017-03-14 10:13:17.890 500-UX-FTPA617 Command rejected by FTPALERT automation rule
< 2017-03-14 10:13:17.890 500 User Exit denies Userid 'MyUser' from using Command 'CWD'.
* 2017-03-14 10:13:17.890 (ECommand) Error changing directory to '/'MyUser.''.
* 2017-03-14 10:13:17.890 UX-FTPA617 Command rejected by FTPALERT automation rule
* 2017-03-14 10:13:17.890 User Exit denies Userid 'MyUser' from using Command 'CWD'.
< 2017-03-14 10:13:17.890 Script: Error changing directory to '/'MyUser.''.
< 2017-03-14 10:13:17.890 UX-FTPA617 Command rejected by FTPALERT automation rule

< 2017-03-14 10:13:17.890 User Exit denies Userid 'MyUser' from using Command 'CWD'.
< 2017-03-14 10:13:17.890 Script: /'MyUser.'
. 2017-03-14 10:13:17.890 Script: Failed
. 2017-03-14 10:13:17.890 Script: Exit code: 1
. 2017-03-14 10:13:17.890 Disconnected from server

Reply with quote

martin
Site Admin
martin avatar

Re: I have the same problem - Here is my Log file

I'm sorry, but WinSCP cannot work with a server that does not allow the CWD command.

Reply with quote

Advertisement

amit9876
Joined:
Posts:
1
Location:
Germany

Empty file download

Hi, I am also facing similar issue while downloading the files. Few files are empty after download.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Empty file download

amit9876 wrote:

Hi, I am also facing similar issue while downloading the files. Few files are empty after download.
Sorry, your post does not include enough information.

Please read how to troubleshoot problems with WinSCP. If it turns out that you are not able to help yourself, read how to ask for support or report bugs efficiently, so others can help you. Start a new thread, if you need our help.

Reply with quote

Advertisement

You can post new topics in this forum