Software⏱️ 3 min read📅 2026-06-19

How to Fix: cp: cannot stat error - when filename has Asian characters

Error message when trying to copy files with Asian characters in their names using the cp command.

Quick Answer: The issue is likely due to the default character encoding of your machine not being able to read the file names. Try setting the LC_CTYPE environment variable to a locale that supports Unicode characters.

The 'cp: cannot stat' error occurs when the file system is unable to locate a file due to issues with filename encoding or path length.

This issue specifically affects users who are trying to copy files using the 'cp -r' command, particularly those containing Asian characters in their filenames.

💡 Why You Are Getting This Error

  • The primary reason for this error is that the default character encoding on your system may not be able to handle the Unicode characters present in the file names. This can lead to incorrect filename interpretation by the operating system.
  • Another possible cause could be issues with path length, but since you've confirmed the issue only occurs with files containing Asian characters, this seems less likely.

🔧 Proven Troubleshooting Steps

Setting the correct locale and encoding

  1. Step 1: Open a terminal and run the command 'export LC_ALL=en_US.UTF-8' to set the default locale to UTF-8.
  2. Step 2: Run 'locale -a' to confirm that the LC_ALL environment variable has been updated correctly.
  3. Step 3: Try running the 'cp -r' command again with the updated locale settings.

Using the 'iconv' command to convert file names

  1. Step 1: Open a terminal and run the command 'iconv -f utf-8 -t ascii//translit /home/user/source/' to convert all filenames in the source directory to ASCII characters.
  2. Step 2: Run 'cp -r /home/user/source/ /home/user/destination/' with the converted filenames.
  3. Step 3: Note that this method may not be suitable for large directories or complex file systems.

🎯 Final Words

To resolve the 'cp: cannot stat' error caused by Asian characters in filenames, try setting the correct locale and encoding using the 'export LC_ALL=en_US.UTF-8' command. If this doesn't work, you can use the 'iconv' command to convert the file names to ASCII characters before attempting the copy operation.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions