Hi Ishan,

As mentioned previously, the file has not changed, just that Windows and 
Linux expect different line endings.

 

This is what worked for me using Powershell, converting Linux line-endings 
to Windows line-endings:

 

- name: convert line endings from Linux to Windows (PowerShell)

  win_shell: '(Get-Content "filename_from") -replace "`n", "`r`n" | 
Set-Content "filename_to.txt"'

 

The reason I needed to do this was that I was checking out text files on 
Linux, then copying them to a Windows server.


But the problem is, Git automatically ensures files have the "right" 
line-endings during checkout (meaning "right" for the machine doing the 
checkout, not the machine the file's copied to.)


Cheers,

 

Nick

On Thursday, 3 March 2016 22:33:17 UTC+11, ishan jain wrote:
>
> I am copying some text files located on a linux file system to windows 
> file system using the win_copy module of Ansible. The final copied file do 
> not have line breaks in it.
>
> So the file which is like this on linux:
>
> line1
> line2
> line3
>
>
> Becomes this on windows:
> line1line2line3
>
> How can i make sure win_copy just copy the file exactly as it is ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a42665bc-2d5a-460c-929b-78a1c1f2a3b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to