Copy to a shared folder and keep line breaks

Discussions related to using VirtualBox on Windows hosts.
Post Reply
DR
Posts: 4
Joined: 5. Mar 2015, 19:41

Copy to a shared folder and keep line breaks

Post 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?
dlharper
Posts: 291
Joined: 25. Aug 2011, 19:17
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: MS Windows (several versions); DOS

Re: Copy to a shared folder and keep line breaks

Post 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.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Copy to a shared folder and keep line breaks

Post by mpack »

Post Reply