sodcalculator

10 Tech How-To

Fix Error 0x80070157: Windows File Copy Error

Guide 10-46741 · Updated · Step by step

Error 0x80070157 occurs when Windows cannot copy or move a file, typically due to a corrupted file name or an issue with the file system. The fix is to rename the file to a shorter, simpler name or copy it to a different location, and if that fails, run a disk check and update your storage drivers. Below is a detailed guide covering the causes, step-by-step solutions, and answers to common questions.

What Is Error 0x80070157?

Error 0x80070157 is a Windows error code that appears when the operating system fails to copy, move, or open a file. The message usually reads: “Error 0x80070157: The file cannot be copied because the file name is too long.” However, the error can also occur for other reasons, such as a corrupted file system, a failing hard drive, or a conflict with third-party software. It is most common when copying files from an external drive, a network share, or a cloud-synced folder.

Why Does the Error Happen?

The primary cause is the file name exceeding the maximum path length limit. Windows traditionally limits a full file path (including the drive letter, folders, and file name) to 260 characters. If a file is deeply nested in folders or has a very long name, the copy operation fails. Other causes include:

  • Corrupted file system – Bad sectors or file system errors can prevent reading the file.
  • File in use – Another program (like a sync client or antivirus) is locking the file.
  • Driver issues – Outdated or faulty storage drivers (USB, SATA) can cause errors during transfers.
  • Permission problems – Lack of write permission to the destination folder.

How to Fix Error 0x80070157

Follow these steps in order. Most users resolve the issue with the first two steps.

Step 1: Rename the File or Shorten the Path

  1. Right-click the file and select Rename.
  2. Change the name to something short, like file1.txt.
  3. If the file is in a deep folder chain, move it to a higher-level folder (e.g., directly on the Desktop or C:\Temp).
  4. Try copying again.

If that works, the issue was the path length. To avoid future problems, consider enabling long path support in Windows (see below).

Step 2: Run a Disk Check

  1. Open Command Prompt as Administrator (right-click Start, choose “Command Prompt (Admin)” or “Terminal (Admin)”).
  2. Type chkdsk C: /f /r (replace C: with the drive letter of the source or destination).
  3. If prompted, type Y to schedule the check on restart, then restart your PC.
  4. Allow the scan to complete; it may take a while.

This repairs file system errors and bad sectors that may cause the error.

Step 3: Close Programs That Might Lock the File

If the file is in a OneDrive, Dropbox, or Google Drive folder, pause syncing temporarily. Also close any media players, editors, or antivirus scans that might be reading the file. Then retry the copy.

Step 4: Update Storage Drivers

  1. Open Device Manager (right-click Start, select Device Manager).
  2. Expand Disk drives and Universal Serial Bus controllers.
  3. Right-click each device and select Update driver > Search automatically.
  4. Restart your PC after updating.

Step 5: Enable Long Path Support (Windows 10/11)

  1. Press Win + R, type gpedit.msc, and press Enter. (If you have Windows Home, skip to the registry method below.)
  2. Navigate to Computer Configuration > Administrative Templates > System > Filesystem.
  3. Double-click Enable Win32 long paths, set it to Enabled, and click OK.
  4. Restart your PC.

For Windows Home, use the Registry Editor:

  1. Press Win + R, type regedit, and press Enter.
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.
  3. Find LongPathsEnabled. If it doesn’t exist, right-click, create a new DWORD (32-bit) value, and name it LongPathsEnabled.
  4. Set its value to 1 and click OK.
  5. Restart your PC.

Note: Enabling long paths only works for applications that are designed to support it. Many older programs still fail.

Step 6: Copy to a Different Location

If the error persists, try copying the file to another drive or folder. If that works, the original destination may have a permission issue or a corrupted folder structure. You can also try copying the file in smaller batches (e.g., one folder at a time) to isolate the problem.

Common Misconceptions

Many users believe that error 0x80070157 always means the file is too long, but it can also be a symptom of a failing drive. If you see this error frequently on the same drive, back up your data immediately and run a SMART test (using tools like CrystalDiskInfo) to check the drive’s health. Also, note that renaming the file does not change the full path length if the folders are deep – you must shorten the entire path.

When to Seek Professional Help

If you’ve tried all the steps above and the error still occurs, the drive may be physically damaged. Stop using it immediately to avoid data loss. Consult a data recovery professional if the data is irreplaceable. For general use, consider replacing the drive.

Frequently Asked Questions

Q: Can I ignore error 0x80070157 and still use my computer?

Yes, but it indicates a problem that could worsen. If the error is due to a long file name, it’s harmless. If it’s due to a failing drive, ignoring it risks data loss. Always back up important files.

Q: Does this error affect only external drives?

No, it can happen on internal drives, network drives, and USB drives. The cause is usually the file path length or file system corruption, not the drive type.

Q: Will enabling long paths break anything?

Enabling long paths is generally safe, but some older applications may not handle long paths correctly and could crash. If you notice issues, you can disable the setting again.

Q: How do I know if my file path is too long?

Right-click the file, select Properties, and look at the “Location” field. Count the characters in the full path (including the file name). If it exceeds 260, that’s likely the cause. You can also use the command dir /s /b in Command Prompt to see full paths.

Q: Can I use a third-party tool to copy files with long paths?

Yes, tools like Robocopy (built into Windows) or 7-Zip can handle long paths. For example, you can use robocopy source destination /E to copy folders recursively. These tools bypass the 260-character limit.

Q: What if the error occurs when copying from a network drive?

Network drives often have their own path length limits. Try mapping the drive to a letter (e.g., Z:) and then copy. Also, check if the server has long path support enabled.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →