2

This is weird.

I have a meanJs installation, the contents of which I copied to another folder.

Original folder path: C:\work\defaults\mean_0.3.3

File contents copied to: C:\work\defaults\a

As you can see it's obvious that the file contents are copied to a folder with a shorter name, so the file name too long error should not come, yet it does.

Is this a windows 10 bug?

Tried to do the it with copy-item command on the powershell and this is part of the output (it goes on for a while):

PS C:\work\defaults> copy-item .\mean_0.3.3\ -destination .\b -recurse
copy-item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260
characters, and the directory name must be less than 248 characters.
At line:1 char:1
+ copy-item .\mean_0.3.3\ -destination .\b -recurse
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (test-delayed-http-upload.js:FileInfo) [Copy-Item], PathTooLongException
    + FullyQualifiedErrorId : CopyDirectoryInfoItemIOError,Microsoft.PowerShell.Commands.CopyItemCommand

copy-item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260
characters, and the directory name must be less than 248 characters.
At line:1 char:1
+ copy-item .\mean_0.3.3\ -destination .\b -recurse
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (test-delayed-stream-auto-pause.js:FileInfo) [Copy-Item], PathTooLongExceptio
   n
    + FullyQualifiedErrorId : CopyDirectoryInfoItemIOError,Microsoft.PowerShell.Commands.CopyItemCommand

copy-item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260
characters, and the directory name must be less than 248 characters.
At line:1 char:1
+ copy-item .\mean_0.3.3\ -destination .\b -recurse
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (test-delayed-stream-pause.js:FileInfo) [Copy-Item], PathTooLongException
    + FullyQualifiedErrorId : CopyDirectoryInfoItemIOError,Microsoft.PowerShell.Commands.CopyItemCommand
2

2 Answers 2

3

The fully qualified path of some subdirectory (before or after copying) is too long. This is a limitation of the cmdlet (and to some extent, the API it targets).

Easiest workaround is to use Robocopy: https://technet.microsoft.com/en-us/library/cc733145.aspx

1

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.

So the reason your file path was able to get so long in the first place was if it was created manually, instead of copied over. Or if it was created from a program, or any other method that doesn't involve copying. At least that's my guess

You must log in to answer this question.

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