4

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?

4
  • What filesystem is your external drive using? May 4, 2015 at 5:01
  • "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.
    – Karan
    May 4, 2015 at 5:35
  • @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. :)
    – NDEIGU
    May 4, 2015 at 6:56
  • 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.
    – Karan
    May 4, 2015 at 6:59

2 Answers 2

5

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

1
  • 1
    Thank you @Allen :) CMD is perfect. No need for GUI.
    – NDEIGU
    May 4, 2015 at 3:16
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .