When we name folders on a Windows system, it needs to be understood that typically, Windows has a limit of the number of characters that could be used for naming the file because it lengthens the destination path of the File Explorer. However, even if you are able to name it, it might not always be possible to copy-paste it to different locations. In such a situation, you would get the following error:
The cause is a limitation with the Win32 API library.
Try the following solutions one by one to fix the problem:
1} Rename the parent folder
2} Temporarily rename the file or folder’s extension to .txt
3} Enable Long Path Support using the Registry Editor
Solution 1] Enable Long Path Support using the Registry Editor
Microsoft was aware of the problem mentioned here. The company didn’t directly increase the limit for a reason, but made it optional for all systems running on Windows 10 built 1607 or further.
Before anything else, update your Windows system to the latest built. The procedure to update Windows is mentioned here.
Thereafter, enable the option through the following procedure:
1] Press Win + R to open the Run window and type the command regedit. Press Enter to open the Registry Editor.
2] Navigate to the following key in the Registry Editor:
3] In the right-pane, double-click on (or right-click >> Modify) LongPathsEnabled.
4] Set the Value data to 1 and click on OK to save the settings.
5] Restart the system and check if it helps solve your problem.
Solution 2] Rename the parent folder
In case you are facing the issue while copying either one or a limited number of files or folders, you might simply consider shortening the name of the parent folder and that could fix the problem. However, one might not always wish to change the name. Even more if the number of files and/or folders are many, the option might not be feasible.
Solution 3] Temporarily rename the file or folder’s extension to .txt
Files with .txt files have a higher limit while transferring. Thus, temporarily change the extension of the files you intend to transfer to .txt. This would make the file unusable. Transfer the file to the intended location and then change the extension to the original one.
In case the name doesn’t show the file extension, open the File Explorer.
Uncheck the box corresponding to Hide extensions for known file types. Click on Apply and then OK to save the settings.
Solution 4] Using elevated Command Prompt
While a direct transfer of the files might not be possible, we could try the same through a command line on elevated Command Prompt.
1] Search for Command Prompt in the Windows search bar. Right-click on the option and select Run as administrator.
2] Type the following command and press Enter to execute it:
xcopy *File explorer path to source files* *File explorer path to destination* /O /X /E /H /K
3] Verify if the transfer was successful.
Hope it helps!