Every windows user has encountered at least once the destination path too long message. This appears mainly when you try to copy or move a file to a folder. Any path-name longer than 256 characters will cause failure of operations like copy/delete/rename.
Full Error: “The file name(s) would be too long for the destination folder. You can shorten the file name and try again, or try a location that has a shorter path.”
Windows has two path length limits. Unicode NTFS has a path length limit of over 32,000 characters for many operations. NTFS volume Windows is able to use that limit when doing a copy, move, or rename within it. But Windows and especially the Win32 API library has a 256/260 folder and name restriction. Some network file systems will also recognize the lower limit. It is possible to use a path of up to 32767 characters when using Unicode API functions.
The name means the entire path of the file/folder starting from the root of the drive, ending with the last subfolder including the file name itself. The system variable MAX_PATH is the one that restricts filenames and file paths to under 260 characters. The error is still encountered on all the recent Windows versions including windows 10 even if the issue is over 20 years old.
How to Fix Destination Path too Long
- Shorten the name of the parent folder
- Temporarily rename the file extension to text
- Using the xcopy command
- Using Robocopy Utility
- Move, Delete, Or Copy Files Or Directories Using PowerShell
- Create a symbolic link
- Hidden share path
- Enable Long Path Support (Windows 10 built 1607 or higher)
- Make Windows 10 Pro Or Enterprise Accept Long File Path
Note!!! Check the article below for the full explanation of every solution above.
The situation when the windows path too long message appears:
Destination path too long – when you try to copy or move files to this destination
File name too long to copy – when you try to edit/rename the file name
Source path too long – when you try to copy or move from this source
Filename too long to delete – when you try to delete the file
The following article will try to fix this issue using the best methods. First to try to fix temporary for certain files/folders. After that to try to fix for permanent.
Shorten the name of the parent folder
This is a simple way and we will start from this. Rename the parent folder to decrease the full path length. Execute your operation to see whether the issue goes away and if not continue with the next steps.
This is not always applicable and especially if you have a lot of files that are exceeding the length limit. This method is applicable when you have a few files/folders to move/delete/copy.
Temporarily rename the file extension to text
According to Microsoft, .txt files have a higher limit while transferring. If for example you have a zip file just rename .zip to .txt and copy/delete/move to the new destination. Please keep in mind that the file will not work if you don revert back to .zip. Check step by step below:
- To rename the file right-click and click to “rename”. Modify only the extension to “.txt”
- You are free to move the file to the new destination.
- Right-click again to rename and revert back the change to “.zip”
Hint! When you try to rename you don’t see the extension, most probability you don’t have it enabled. To enable it go to file explorer and access the view tab. Check the box associated with File name extensions.
- View >> Options >> Change folder and search options >> View tab
- Uncheck the box corresponding to Hide extensions for known file types
Using the xcopy command
Some users over the internet are reporting that using xcopy command in an elevated command prompt can solve the issue of windows destination path too long. The solution can solve also “Windows file name too long to copy” or “Source path too long”. Check the steps below:
- Open CMD by clicking start and search for cmd. Right-click and Run as administrator
- Execute the following command by copy and paste to command Prompt:
xcopy *path to source files* *path to destination* /O /X /E /H /K
Note! Edit xcopy *path to source files* the *path to destination* to your real file path.
After click Enter, the file will be transferred. Check the destination if it was successful.
Using Robocopy Utility
Something like xcopy is also robocopy. You can use this windows utility to copy or move data. For example, we will fix below the error when you try to delete long file names. Use CMD again to execute the commands.
First, you will need to move the files with long file name from the directory:
ROBOCOPY c:\testetst1\testetst2\testetst3\longpath\testets.zip c:\tmp\ /MOVE /E
After that to delete the files from the source directory:
Delete c:\testetst1\testetst2\testetst3\longpath\testets.zip /q /f
Read also other Windows Solutions for:
- How to Find Large Files on Windows
- Enable Bitlocker on Windows
- Windows Logon Type
- How to delete hiberfil.sys
Move, Delete, Or Copy Files Or Directories Using PowerShell
PowerShell is known as a powerful tool used by power-users to automate and solve many windows problems. Below we will solve the Destination Path too Long error when copy, move, or delete using the PowerShell tool. First, open the PowerShell tool by search it on the windows menu.
Copy Directory Using Copy-Item
So in the first example, we will try to copy the “TestSource” directory to “TestDestination”. The cmdlet item for this operation is Copy-Item following by parameters “-Destination” and “-Recurse”. You need to be inside the path where the “TestSource” directory is located.
Copy-Item TestSource -Destination TestDestination –Recurse
-Destination – Where we want the copy to be
-Recurse – Copy all the items inside to the destination
Note! The copy command will not remove the files inside the source the folder.
Move Directory Using Move-Item
Instead of Copy-Item, you can use the Move-Item cmdlet in order to move permanently the files from the source to the destination.
Move-Item -Path TestSource -Destination TestDestination
-Path – Defines the item we want to move
-Destination – Where we want the copy to be
Delete Directory Using Remove-Item
In order to delete the directory and all the files inside it we will need to use the Remove-Item cmdlet.
Remove-Item TestSource -Recurse -Force
-Recurse – Delete everything inside
-Force – Make it do that without asking us if we’re sure for every item inside.
Create a symbolic link
Creating a symbolic link to a part of the path can short the total path length of the file/directory. The below command executed on CMD can finish the work:
mklink /D "C:\Link To Folder" "C:\Users\Name\Original Folder"
In order for this trick to work you will need to use “C:\Link To Folder” to perform file operations.
Hidden share path
This solution works especially on file share paths when you need to move a lot of directories from a place to another. What you need to do is to map the path in order to short it.
- Navigate to the full path and copy it
- Go to My Computer and click to “Map Network Drive”
- Select your preferred drive later
- Past the long directory path in the “Folder” box
You can copy files and directories from this path and into it without receiving the “Destination path too long” error.
Enable Long Path Support (Windows 10 built 1607 or higher)
Windows 10 on the new anniversary update 1607 has provided the possibility to disable the path restriction on the system level. So the MAX_PATH limit now can be changed on Registry Editor. Below the steps:
- First, you will need to update your windows 10 with 1607 or higher
- Open the Registry editor by typing (Win+R) and after that type Regedit. After pressing Enter will open Registry Editor
- Go to the following path on Registry Editor: Computer >> HKEY_LOCAL_MACHINE >> SYSTEM >> CurrentControlSet >> Control >> FileSystem
- On the right window pane double-click on the “LongPathsEnabled”.
- Edit the value data to “1” and click ok in order that the changes be saved.
- Close the Registry Editor and try to move/copy/delete the long-named files or folders.
Make Windows 10 Pro Or Enterprise Accept Long File Path
Windows 10 Pro Or Enterprise comes with a feature to enable long file path from Group Policy Editor. To make this function you will need
- Open the Group Policy Editor by going to the Start menu and typing in gpedit
- navigate to Computer Configuration > Administrative Templates > System > Filesystem
- Double-click on Enable Win32 long paths and change it from Disabled to Enabled
- Click ok in order to be effective
- Try to force the group policy to update
- Check if you can copy, move, or delete a long file path or directory.
We are at the end of our article/guide to resolve the error for Destination Path too Long on windows 10 but not only. The article tries to include every possible solution. Let’s hope that you have found the solution to your situation. Inform us below if you have any other solution working.