FTP Scripts and log file output

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

FTP Scripts and log file output

#1 Post by Squashman » 07 Nov 2012 13:30

Just got moved over to Windows 7 at work. Been on XP for an eternity. I have a batch file that does some FTP automation. The script works perfect on XP and Windows 7 but I noticed that the LOG file being captured from the FTP command isn't all nice and neat like it was on XP and I am not sure why.

So the batch files builds the FTP script and then just runs the script.

Code: Select all

C:\WINDOWS\system32\ftp.exe -n -i -s:"%_FTPScript%">FTP_Transfer_%_LogNum%.log


When I ran it on XP last week the output looked nice and neat.

Code: Select all

ftp> Connected to ftp.server.com.

open ftp.server.com

ftp> user squash
331 Enter password

230 User logged in
ftp> cd in
250 Command CWD succeed
ftp> mkdir 99999
550 Folder 99999 already exists

ftp> cd 99999
250 Command CWD succeed
ftp> binary
200 Transfer mode set to BINARY
ftp> put "99999_FILE1.zip"
200 Command PORT succeed
150 Uploading in BINARY file 99999_FILE1.zip
226 Transfer completed
ftp: 1818669 bytes sent in 1.70Seconds 1068.55Kbytes/sec.

ftp> put "99999_FILE2.zip"
200 Command PORT succeed
150 Uploading in BINARY file 99999_FILE2.zip
226 Transfer completed
ftp: 1691791 bytes sent in 0.94Seconds 1797.87Kbytes/sec.

ftp> quit
221 bye

Ran the script this week on Windows 7 and the output to the log file wraps and it doesn't have a blank line in between each PUT execution. See how the seconds from the transfer wrap to the next line and the PUT command follows right after the seconds. Bugs the heck out of me. That shouldn't happen!

Code: Select all

ftp> Connected to ftp.server.com.
open ftp.server.com
ftp> user squash
331 Enter password

230 User logged in
ftp> cd "in/99999"
250 Command CWD succeed
ftp> binary
200 Transfer mode set to BINARY
ftp> put "99999_FILE1.zip"
200 Command PORT succeed
150 Uploading in BINARY file 99999_FILE1.zip
226 Transfer completed
ftp: 18925580 bytes sent in Seconds Kbytes/sec.
ftp> 10.591786.78put "99999_FILE2.zip"
200 Command PORT succeed
150 Uploading in BINARY file 99999_FILE2.zip
226 Transfer completed
ftp: 13624357 bytes sent in Seconds Kbytes/sec.
ftp> 9.481436.71quit
221 bye


Can anyone else confirm this happens on their version of Windows XP and/or Windows 7 please? I would really appreciate.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: FTP Scripts and log file output

#2 Post by Squashman » 07 Nov 2012 15:01

Well I found another guy bitching about it. Apparently this has been happening since Vista.
Everything will output fine to the screen but if you use a script and redirect to a LOG FILE it screws up.

I guess people used to use FTP batch scripts to do speed tests on the internet.
http://social.technet.microsoft.com/For ... 84747b1c19

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: FTP Scripts and log file output

#3 Post by foxidrive » 07 Nov 2012 23:06

I was going to test this and then I realised that I'm on Win8.

Anyway, FWIW this is what I get:

230 User bartsimpson logged in, access restrictions apply.
ftp> binary
200 Type set to I.
ftp> cd /
250 CWD command successful.
ftp> put a4.bat
200 PORT command successful.
150 Opening BINARY mode data connection for 'a4.bat'.
226 Transfer complete.
ftp: 416 bytes sent in 0.14Seconds 3.06Kbytes/sec.
ftp> put a5.bat
200 PORT command successful.
150 Opening BINARY mode data connection for 'A5.BAT'.
226 Transfer complete.
ftp: 346 bytes sent in 0.13Seconds 2.58Kbytes/sec.
ftp> quit
221 Goodbye.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: FTP Scripts and log file output

#4 Post by Squashman » 08 Nov 2012 07:14

Well it is nice to know they fixed it in Windows 8! Which my company will probably never move to. In my company the Tile Interface would be a hindrance to all the custom applications we have written in house.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: FTP Scripts and log file output

#5 Post by Squashman » 08 May 2013 09:56

Hey Foxidrive,
On Windows 7 I have FTP.exe in System32 and SysWow.
The system32 version says it is 47KB and the SysWow version says it is 41.5KB in size.
The version in the properties tabs says 6.1.7601.17514. But that really corresponds to me running Windows 7. So I don't think that is a true file version.

What do you have for Windows 8?

Right now I force my script to use the System32 version. I wonder what version it uses if you don't specify a path?

Regardless, I still get the same screwed up output when redirecting the output of the ftp script to a log file with both versions.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: FTP Scripts and log file output

#6 Post by foxidrive » 08 May 2013 21:14

This machine is a 32 bit version so doesn't have the syswow

I only have the one FTP.EXE - but maybe you could snaffle an FTP.EXE from a Win 8 machine??

Post Reply