LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   cp problems (https://www.linuxquestions.org/questions/linux-desktop-74/cp-problems-626839/)

awl 03-09-2008 02:38 PM

cp problems
 
Hello,

I needed to copy some files from an winxp ntfs partition to some other place using linux. The problem was that midnight commander i was using to copy the files had a problem with filnames from the ntfs partition which are containing non-ASCII characters (the error was: "...invalid multibyte character..." or similar. I think that on one previous occasion i had the same problem with 'cp' command as well.). Is there some workaround to copy those files?

MensaWater 03-09-2008 03:51 PM

From command line when there are odd (non-printing) characters in a filename I've sometimes been able to overcome it by using meta-characters.

Say there were a file that "ls *" displayed as "thisfile" but wouldn't show up when I typed "ls thisfile" I'd know there was a character I couldn't see. So I would try to find a pattern that would match ONLY "thisfile" such as "ls "thisf*" or "ls *hisf*". Once I was sure the ls command had listed only the file I was interested in I would use the same pattern in the copy

So "cp *hisf* newfile" to copy to a new name in same directory or "cp *hisf* newdir" to copy with the same name to a new directory.

Sometimes even that fails due to the special character(s) so putting "./" in front of the pattern helps. "cp ./*hisfile* newfile".

awl 03-10-2008 03:42 AM

To make my question a bit more precise, the NTFS partition in question is yet another WinXP volume which needs to be reformatted and reinstalled due to accumulated malfunction over time to the point of complete disfunction. But the problem is that it has various important *.doc files in various directories which I need to copy somewhere else befor i destroy the system. These documents have sometimes filenames which include Serbian characters (Latin, not Cyrillic) that "cp" has problem with (cannot stat: blah blah invalid or incomplete multibyte character).

Another problem is that am using console-only rescue Linux distribution(PLD linux) to do the copying. This means I can't just run some UTF friendly Gnome/KDE app for the job. Also, even if i could execute the recommended "cp strangecharacterfollows*.doc aconsoletorelablename.doc" command, this is unfeasible because I have numerous different docs all over the directory tree (or yes, maybe I could do it, but doing this manually for each file seems a bit frightening. I would rather like a cp -R Documents\ and\ Settings solution).

Looking at the enviroment variables in PLD linux, I see that supported locales have some of the UTF-8 ones. I thought this should be enough for the console commands to recognise UTF-8 characters, but it seems it is not.

Any furhter advice??? (Instead of downloading a live distribution containing KDE or Gnome. Bandwidth problems there.)


All times are GMT -5. The time now is 07:28 PM.