Archived Forum Post

Index of archived forum posts

Question:

SFTP line termination characters between windows and unix

Jan 20 '14 at 11:30

How is it possible to convert CRLF line endings to LF line-endings when uploading a file from Windows to Linux/Unix?


Answer

One possibility is to add ", textMode" to the createDisposition argument of the sftp.OpenFile method. For example:

bool success = sftp.OpenFile("something.txt","readWrite","openOrCreate, textMode");

This assumes the server pay attention to the "textMode" disposition and implements it. Otherwise, the solution is to convert the CRLF to LF line endings prior to upload.