Topic "CR/LF being replaced with LF during scripted transfer"

Author Message
doughtsh
[View user's profile]

Joined: 06 May 2009
Posts: 2
Using v4.1.8 on Windows Server 2003
I'm using WinSCP in a SQL Server 2005 Integration Services package (Execute Process task) as follows

Executable: C:\Program Files\WinSCP\WinSCP.exe
Arguments: -script=\\dcf\data$\shared_sh\mirror.txt

Contents of mirror.txt (redacted)

option batch on
option confirm off
open sftp://username:password@server.IP.address:22
option transfer ascii
put \\dcf\data$\Shared_SH\mgnfin_leg_dignity_6_0409.csv
put \\dcf\data$\Shared_SH\mgnfin_leg_dignity_6_0409.sum
close
exit

The two files being transferred are plain text with CR/LF line delimiters (I've doublechecked this with a hex editor!). The files transfer fine but I've had a message back from the recipient that CR/LF has been replaced with LF in the file. I have no idea what software is running at the other end. I can't see an option in the help for setting the line delimiter in a script. If it's relevant, I have to use UNC names as mapped drives are not available to the domain account which runs the process.

Any tips?

Thanks
Scott
Advertisements
Freitag
[View user's profile]

Joined: 25 Oct 2007
Posts: 29
Use binary transfer mode instead of ascii and the translation should stop.

The manual setting of mode should also circumvent any automatic text mode, but you might have to remove the rule for that file type if it does not.
prikryl
[View user's profile]
Site Admin
Joined: 10 Dec 2002
Posts: 11779
Location: Prague, Czech republic
Exactly. Use "option transfer binary".
See documentation to understand transfer modes.
_________________
Martin Prikryl
doughtsh
[View user's profile]

Joined: 06 May 2009
Posts: 2
Thank you both. My initial reasoning was that if I'm sending a text file, the transfer mode should be ASCII but reading the suggested page in the manual explained why that was wrong, so I've learned something which is more generally useful.

Scott
Advertisements

You can post new topics in this forum




Search

What is WinSCP?

WinSCP is an open source SFTP client and FTP client for Windows. Its main function is the secure file transfer between a local and a remote computer. Beyond this, WinSCP offers basic file manager functionality. It uses Secure Shell (SSH) and supports, in addition to Secure FTP, also legacy SCP protocol. [More]

WinSCP is also available as a plugin to two file managers, FAR and Altap Salamander.

Donate

Donate via PayPal

License

WinSCP is free, open-source software, and is distributed under the GNU General Public License (GPL). [More]

Associations

Site design by Black Gate