If performing the transfer in Binary doesn't retain the formatting you want, there is a freeware program called Unix2Dos (Just Google that and you'll see it).
Upon successful upload of a file, you can call a local command (Unix2Dos) and pass the name of the file just received and it will translate all the LF to CRLF for you.
Lead Solutions Consultant
I have actually done some work around this in the past using Director, Python, Unix2Dos, AWK, Perl and sed to find the quickest approach and using the Director Search and Replace task is just as quick as any other methods.
For all of my tests I used a 51MB CSV file that contained 2,823,001 lines,
In Director you can just use a Search and Replace task
<project name="convertlf" mainModule="Main" version="2.0"> <module name="Main"> <searchAndReplace inputFile="/root/testFiles/test.csv" outputFile="/root/testFiles/converted.csv" searchFor="\n" replaceWith="\r\n" version="1.0" disabled="false" /> </module> </project>
18/10/13 12:22:47.0492 PM INFO Executing task 'searchAndReplace 1.0' 18/10/13 12:22:48.0865 PM INFO 1 file(s) were scanned for '\n' and a total of 2,823,000 replacements were made with '\r\n' 18/10/13 12:22:48.0865 PM INFO Finished task 'searchAndReplace 1.0'
You can call Unix2Dos as a native command and all you need to pass is the input file but for my test I did not run it in Director.
[email protected]:~/testFiles# time unix2dos test.csv unix2dos: converting file test.csv to DOS format ... real 0m1.065s user 0m0.932s sys 0m0.112s
data = open("test.csv", "rb").read() newdata = data.replace("\n","\r\n") if newdata != data: f = open("test.csv", "wb") f.write(newdata) f.close()
[email protected]:~/testFiles# time python cnvrt.py real 0m0.203s user 0m0.064s sys 0m0.136s
[email protected]:~/testFiles# time perl -p -e 's/\n/\r\n/' < test.csv > converted.csv real 0m3.055s user 0m2.868s sys 0m0.136s
These 2 were more for fun than anything else and only apply if you are running on a Unix / Linux system
[email protected]:~/testFiles# time awk 'sub("$", "\r")' test.csv > converted.csv real 0m0.631s user 0m0.436s sys 0m0.192s