# cp... Illegal byte sequence on NTFS drive



## killbiitch (Jan 3, 2013)

Hello everybody.

My second post in one week (I'm a very active newbie :stud). 
I have an external USB drive with NTFS (I use it with ntfs-3g).
Something weird happens to me: I try to copy a big folder from my UFS internal drive to my NTFS external drive and the copy stops to some folder with the message"illegal byte sequence"

For instance:

me: cp -R /home/killbiitch/psychologie /media/HDD2

=>FreeBSD: =>  /media/HDD2/documents/Psychologie/: Illegal byte sequence" 

Does anyone could explain me what happens and how to fix it? I've searched but not found explanations :/

Thanks in advance if you can help, I'm very new concerning UNIX systems :e


----------



## killbiitch (Jan 3, 2013)

Sorry errata 

=>FreeBSD:  /media/HDD2/documents/psychologie/memoire et thÃ¨se: Illegal byte sequence" 

or

=>FreeBSD:  /media/HDD2/documents/psychologie/stages/Gui de Chauliac: Illegal byte sequence"


----------



## Beastie (Jan 3, 2013)

It's possible it doesn't understand the accent grave but I'm not sure. Try removing the accent.

It doesn't understand the spaces between words either and interprets the remaining words as shell arguments. You can escape spaces like this:
`% cp -R /.../.../memoire\ et\ thÃ¨se /media/HDD2`


----------



## killbiitch (Jan 3, 2013)

Thanks that's working and the problem was the spaces.. but there are a lot (a lot a lot!) of folders into "Psychologie's" folder that contains spaces! Folder "Psychologie" size is almost 10Gb.
Do I have to rename all of them manually?
And do you have idea why these spaces are supported on the system and not concerning the copy on the NTFS external drive? Maybe a bug from ntfs-3g?


----------



## killbiitch (Jan 3, 2013)

Well I've formated the entire disk with `fdisk -I /dev/da0`, `bsdlabel` and `newfs -U`.
And I've successfully transferred my folders and files without this error.
I think it's a bug related to ntfs-3g (efficient for writing new files on NTFS partition but beware concerning transfer of existing files and folders with spaces)


----------



## MorgothV8 (Jan 4, 2013)

You can always write some program/script to rename spaces to underscores in file hierarch - that's some solution too. But I see You already managed it.


----------



## kpa (Jan 4, 2013)

You can do this to check if the filesystem handles the spaces properly. It should print every file name correctly, each file name on its own line. 

`# find /path/to/files -print0 | xargs -0 -n1`

If the above works then the problems are with proper quoting the file names in a shell.


----------



## sirrix (Oct 27, 2015)

killbiitch said:


> Well I've formated the entire disk with fdisk -I /dev/da0, bsdlabel and newfs -U.
> And I've successfully transfered my folders and files without this error.
> I think it's a bug related to ntfs-3g (efficient for writing new files on NTFS partition but beware concerning transfer of existing files and folders with spaces)


Can you explain the command please? Thanks.


----------

