To solve the problem, you need to find the offending files where the full path and the filename are greater than 255 characters. Since finding the length in a batch file is a bit of a dogs dinner, I use the following VBScript.
Save the code below into a file called longpaths.vbs. Run it from a DOS command prompt with the following cscript longpaths.vbs <path> <length> where <path> is the location of the folder (don't forget to enclose it in quotes if you have a space) and <length> is the length of the path above which it should flag.
Code is as follows:
Option Explicit
If WScript.Arguments.Count <> 2 Then
WScript.Echo "Usage: " & WScript.ScriptName & " <path> <max length>"
WScript.Quit
End If
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(WScript.Arguments(0)) = False Then
WScript.Echo WScript.Arguments(0) & " - Invalid path or no such folder."
WScript.Quit
End If
Dim oFolder : Set oFolder = fso.GetFolder(WScript.Arguments(0))
Dim iLength : iLength = CInt(WScript.Arguments(1))
Dim iCount : iCount = 0
WScript.Echo "Looking for paths longer than " & iLength & " characters in " & oFolder.Path
On Error Resume Next
Call ScanFolder(oFolder)
On Error Goto 0
WScript.Echo "Found " & iCount & "."
WScript.Quit
Sub ScanFolder(oScanFolder)
Dim oFile : For Each oFile in oScanFolder.Files
If Len(oFile.Path) > iLength Then
WScript.Echo oFile.Path
iCount = iCount + 1
End If
Next
For Each oFile in oScanFolder.SubFolders
Call ScanFolder(oFile)
Next
End Sub
Sample usage and output:
D:\Development>cscript longpath.vbs c:\Windows 210
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Looking for paths longer than 210 characters in C:\Windows
C:\Windows\assembly\GAC_MSIL\Microsoft.Security.ApplicationId.Wizards.AutomaticRuleGenerationWizard.resources\6.1.0.0_en_31bf3856ad364e35\Microsoft.Security.ApplicationId.Wizards.AutomaticRuleGenerationWizard.resources.dll
Found 1.
D:\Development>
Once you know the problem files, you can either rename them so they are shorter, rename one of the folders in that path or (possibly) map a network drive to a sub-folder in that path which will reduce the length of the path.