1

I am simply trying to copy files using cp -r /home/user/source/ /home/user/destination/ but it throws me the cp: cannot stat /source/filename.xxx error for some of the files. When I searched for this error, I found some matching questions such as this,this and this which although have the same error thrown by cp command but the reasons are different. Their solutions do not address my problem.

Upon looking closely, I saw that this error was being thrown only for files whose names contained Asian characters. For example,

cp: cannot stat /source/고정폭.collection

Does anyone have a solution for this? May be the default character encoding for my machine is not reading these file names.

EDIT 1: The output of my locale

LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

EDIT 2: Output of ls -l in the source directory

ls: cannot access 고정폭.collection: No such file or directory
ls: cannot access 기존.collection: No such file or directory
ls: cannot access 모던.collection: No such file or directory
ls: cannot access 웹.collection: No such file or directory
ls: cannot access 재미.collection: No such file or directory
total 4
-????????? ? ?    ?      ?            ? 웹.collection
-????????? ? ?    ?      ?            ? 기존.collection
-????????? ? ?    ?      ?            ? 모던.collection
-????????? ? ?    ?      ?            ? 재미.collection
-????????? ? ?    ?      ?            ? 고정폭.collection
-rw------- 1 root root 856 Jul 24  2007 PDF.collection
Abhinav
  • 111
  • 4
  • What filesystem are those files stored on? Is it, by any chance, NTFS (Windows)? – rici Apr 04 '15 at 00:30
  • source ext2/ext3, destination hfs+ – Abhinav Apr 04 '15 at 00:38
  • Ah. And you're using linux, not Mac OS X, right? – rici Apr 04 '15 at 00:42
  • @rici yes, I am – Abhinav Apr 04 '15 at 00:45
  • How did you create those files in the first place? I might have had an explanation for the filenames not working on HFS+, but I don't see why they would cause problems on ext4. – rici Apr 04 '15 at 00:54
  • I am trying to put a fresh install of OSX on an iMac (unfortunately thats my only option right now). I got a installation usb made on a mac system earlier. It didnt work. I decided, that I copy the content from the USB (hfs+ system) on my system (ext4) and then erase the USB and make a bootable USB for the iMac on my linux machine. So bottomline, can this be happening because I made a copy first from `hfs+ -> ext4` and then erased the USB and while making the bootable USB, again trying to copy the content from `ext4 -> hfs+` ? – Abhinav Apr 04 '15 at 01:00
  • Yes, it's possible. HFS+ requires filenames to be stored in an idiosyncratic decomposition normalization; Hangul (Korean) will be decomposed. Afaik, ext4 doesn't have any restrictions on filenames, but it seems like somewhere in the API, the decomposed names are being recomposed, and the composed names don't match the original filenames. Unless you need a Korean MacOSX, the non-existence of the files shouldn't matter and you might be able to continue without worrying about the files which don't copy, but no promises. – rici Apr 04 '15 at 01:06
  • @rici ok, let me try it that way – Abhinav Apr 04 '15 at 01:12

0 Answers0