Every windows user has encountered at least once the destination path too long message. This appear mainly when you try to copy or move a file to a folder. Any path-name longer than 256 characters will cause fail 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 mean entire path of file/folder starting from root of the drive, ending with the last subfolder including 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 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 the simple way and we will start from this. Rename 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 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 enable. 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 user over 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* dhe *path to destination* to your real file path.
After click Enter the file will be transferred. Check the destination if it was successfully.
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 directory:
ROBOCOPY c:\testetst1\testetst2\testetst3\longpath\testets.zip c:\tmp\ /MOVE /E
After that to delete the files from 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 known as power tool used from 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 PowerShell tool by search it on windows menu.
Copy Directory Using Copy-Item
So in the first example we will try to copy “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 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 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 this trick to work you will need to use “C:\Link To Folder” to perform file operations.
Hidden share path
This solutions 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 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 to 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 come with a feature to enable long file path from Group Policy Editor. To make this functional 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 long file path or directory.
We are in the end of our article/guide to resolve error for Destination Path too Long on windows 10 but not only. The article try to include every possibly solutions. Let’s hope that you have found the solution for your situation. Inform us below if you have any other solution working.