Source path too long - BUT IT NEVER USED TO BE

6,920

Solution 1

You may be nested deeper than you were previously if you are using the Windows user folders under C:\%HOMEPATH%\Documents etc. or any number of other reasons.

Flattening your structure with shorter names is really your only option. To clean up the offending directory, make sure you have your files safely stored in a new folder and clean up the old one like this:

Use the built-in command ROBOCOPY. You don't have to install anything. Create the replica of the bad folder (d:) that is totally empty (e:) on a different drive. Then run robocopy with these params.

robocopy e:\folder d:\folder /Purge /E /S /R:0 /W:0

Two more resources that should help:

With the ironically named URL... http://vimalsuresh.com/2013/08/08/how-to-fix-file-path-too-long-error-while-copying-deleting-or-opening-files-without-using-third-party-applications/

And if you don't like CMD, a utility for getting to files that are way too long (assuming you have them backed up)... http://backupchain.com/DeleteLongPath.html

Solution 2

Just wanted to mention that you do not need to change any folder or file names, like the other answer suggests. You can use the robocopy command, but I found the easier (though a bit slower) method is to just zip the folder, copy the zip, and unzip it. Alternatively you can move the heavily nested folder up to a higher-level directory, copy it over, and then move it back to it's nested location.

Not sure why this works, but according to this article windows has a max length for file name, but for some reason checks the length of the entire file path when copying.

Share:
6,920

Related videos on Youtube

NDEIGU
Author by

NDEIGU

Updated on September 18, 2022

Comments

  • NDEIGU
    NDEIGU almost 2 years

    I am getting the following error while trying to copy backed up data from my external hard drive to my desktop:

    The source filename(s) are longer than is supported by the file system. Try moving to a location which has a shorter path name, or try renaming them to shorter name(s) before attempting this operation.

    And it's really annoying, and now I can't do certain things cause I can't get those files. I like to keep my stuff organized - but it looks like Windows can't support long locations - which means I can't keep things as organized as I want. But this never used to be a problem. On my old computer, I was always copying these backed up files to and fro and it's only since I got this new PC (which is supposed to be like a billion times better) that I've encountered this error.

    And renaming files/folders to just 1 letter until I've copied them is not the right solution. How can I fix this? And why am I having this problem on a higher-spec pc with the same version of windows when I NEVER had this problem on my lower-spec pc with the same version of windows?

    • David Schwartz
      David Schwartz about 9 years
      What filesystem is your external drive using?
    • Karan
      Karan about 9 years
      "it looks like Windows can't support long locations" - Actually UNC paths can be 32k chars long but due to lots of API functions and consequently even parts of Windows like cmd supporting only MAX_PATH, and due to MS' fear of breaking backwards compatibility, in practice 260 chars remains the limit.
    • NDEIGU
      NDEIGU about 9 years
      @Karan yep. 260 chars... nowhere near enough. I can easily use that much: 045504052015 .045604052015 ..045704052015 ... etc. And yes, incase you were wondering, I really do need to name them that way. :)
    • Karan
      Karan about 9 years
      There are utilities no doubt (don't ask me for recommendations though) that can deal with UNC paths, but you'll have to stick with those which is a pain.
  • NDEIGU
    NDEIGU about 9 years
    Thank you @Allen :) CMD is perfect. No need for GUI.