Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

MENU MENU
Post a message here if you find anything wrong in ScriptFTP.
I have used ScriptFTP to copy a txt file form Linux to Windows without any issues, but when you open the txt file in Windows the file becomed corrupt/format changes. I think that this is due to CR/LR within the Linux file.

I have found the following general comment on the web:

A common way to transfer files between a computer and a server is FTP. All FTP software can transfer files in "ascii" or "binary" mode. In "ascii" mode, the FTP software will convert line breaks, while in "binary" mode it will not. In "ascii" mode, transferring a Windows file from a Windows PC to a Linux server results in a UNIX file on the server. Downloading the file again converts it back to Windows. This system works perfectly if you remember to turn on "ascii" mode for text files. Many FTP clients also have an "automatic" mode that switches between ascii and binary depending on the extension of the file you're transferring.

Has any one else had this problem and found a fix/resolution for this issue?

Thanks

Rich
I've attached in this post the file and the screenshots that Richard sent me by email. This way the rest of users can have an idea about what is going on. Richard, if you think I should remove this from the forum just tell me to do so.

I've seen on your file that the new line characters are not the standard ones that Windows uses. They should have been translated from the encoding used in Unix/Linux.

This encoding translation is done in the FTP server side. Could you confirm if using another FTP client (like fileZilla) occurs the same error?
Attachments
image001.png
image001.png (17.49 KiB) Viewed 7255 times
image002 (1).png
image002 (1).png (14.41 KiB) Viewed 7255 times
malformed new line characters text file
(10.31 KiB) Downloaded 461 times
Follow-up from the conversation between Richard and me:

Richard said:
Hello Carlos,

This does not happen when using FileZilla or WinSCP

FileZilla, seems to have the following options:

· Auto

· Binary

· ASCII


When set to AUTO FileZilla seems to know that it is a Linux file and takes the required actions to correct the format.

I did find the following applications called flip (see http://www.wilsonmar.com/1eschars.htm and https://ccrma.stanford.edu/~craig/utility/flip/), which seems to resolve this issue

The flip application allows you to do the following:

Usage: flip [-t|-u|-d|-m] filename[s]
Converts ASCII files between Unix, MS-DOS/Windows, or Macintosh newline formats

Options:
-u = convert file(s) to Unix newline format (newline)
-d = convert file(s) to MS-DOS/Windows newline format (linefeed + newline)
-m = convert file(s) to Macintosh newline format (linefeed)
-t = display current file type, no file modifications

Regards

Rich
Me:
Thanks for the follow up and the workaround Richard. I will file this as a bug to be solved in the next version of ScriptFTP.