Page 1 of 1

Copy to a shared folder and keep line breaks

Posted: 11. Mar 2015, 03:56
by DR
This might be a more general linux question than a virtualbox question, but I am new to linux so I am not sure.

I run a cp command with the -a flag to copy a folder to the shared folder with my host, Windows 7.

Code: Select all

sudo cp -a path/to/guest/file /path/to/shared/folder
The problem is the line breaks in files are not interpreted as line breaks on Windows. Is there a cp flag or vbox command (or anything else) I can use to replace line breaks when copying to a shared folder?

Re: Copy to a shared folder and keep line breaks

Posted: 11. Mar 2015, 10:58
by dlharper
This is nothing to do with virtual machines or shared folders. It is just due to a difference between Unix and Windows. (A new-line in Unix is saved by default as a single character (character 10 - line-feed), in Windows it is two characters (character 13 - carriage return, then character 10)).

Many programs will recognise either format, but some (like Windows Notepad) will not. See if there is a "Windows mode" in your Unix program, or use a different editor in Windows.

Re: Copy to a shared folder and keep line breaks

Posted: 11. Mar 2015, 11:53
by mpack