Destination Path Too Long Fix (when Moving/Copying a File)

If you are facing the error Destination Path Too Long when trying to copy or move a file to a folder, try the quick trick below. The reason you receive the error is that File Explorer failed to copy/delete/rename any path-name longer than 256 characters. The instructions below apply to Windows XP, Windows 7, Windows 8, Windows 10, Windows Server 2003, Windows Server 2008, and Windows Server 2012R2/2016/2019.

This is not the limitation of the NTFS file system, but the Win32 API library. In Win32 API the MAX_PATH value is 260. Most standard applications, including Windows Explorer (File Explorer), do not work correctly with long path files exceeding 256 characters. Under the file name, Windows understands the entire path, starting with the root of the drive, ending with the last subfolder, and the file name itself.

When using Unicode API functions, it’s possible to use a path of up to 32767 characters. Thanks to this, many third-party programs (the popular file managers, for example FAR and Total Commander) process files/folders which path length exceeds 256 characters without any problems.

Note. Some programs use the UNC file path format (prefixed with ?) to bypass the limitations of the Win32 API. For example, the absolute file path might look like this:

\\?C:\folder1\subfolder1\toolongfilename

Due to max path length limitations, the administrator may encounter the following problems:

  • Users can create files and folders in a shared network folder that the administrator (or management scripts) cannot access locally;
  • Errors when synchronizing roaming profiles;
  • Errors data recovery from shadow copies;
  • Incorrect calculation of the directories size;
  • Lost of files during migration and data transfer between servers, etc.

Destination Path Too Long Fix

Full Error:

Destination Path Too Long

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.

Destination Path Too Long error on Windows 10 20H2
Destination Path Too Long error on Windows 10 20H2

Solution 1. Rename Parent Folder to Decrease the Full Path

The simplest way is to shorten the name of the parent folders, decreasing the total path length (but not always applicable) by simply renaming it.

Solution 2. Create a Symbolic Link

Another option is to create a symbolic link to a part of the path, thus shortening the total path length. To create a link, you can use the following command:

mklink /d c:\homelink “C:\verylongpathhere……”

Next, perform file operations with the directory to which the symbolic link is assigned (c:\homelink in our case).

Solution 3. Use Subst Utility

Another option is to associate the problem folder to a virtual disk (in our example, Z:), using the built-in utility Subst. Thus, you can also shorten the path length:

Subst Z: “C:\verylongpathhere……”

Now you can work with the data on the Z: drive, the path to the files in which will not exceed the Win32 API path limit. After the job is finished, you can delete the virtual disk using the Subst with the /d option:

Subst Z: /d

Solution 4. Hidden Share Path

Step 1

The quickest fix for this (especially if you need to simply migrate (move) a lot of folders from one place to another) is to map a drive to the drilled down the folder.

What you should do is browse to the hidden share path and copy it to your clipboard.

destination path too long

Step 2

Then browse to “Computer” or “My Computer”, and click on Map Network Drive. Depending on your OS, it might appear under the tools menu.

destination path too long windows 10

Step 3

Then simply paste your long folder path and hit Finish.

the file name would be too long for the destination folder

Step 4

Now you will be able to copy the files/folders into this location without receiving the error.

Solution 5. How to Enable Long Path Support in Windows 10 (1607) and Higher

Since Windows 10 Anniversary Update (1607), it became possible to disable the MAX_PATH limit for manifested win32 and Windows Store apps on the Windows operation system level without using prefix \\?. By default, this feature is disabled.

To enable the built-in support for long paths in Windows 10/Windows Server 2016/2019, use the Regedit.exe editor to set the LongPathsEnabled parameter of REG_DWORD in the registry key HKLM\SYSTEM\CurrentControlSet\ControlFileSystem with a value 1.

destination path too long windows 10 fix

You can change this registry parameter with the following PowerShell command:

Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem -Name LongPathsEnabled -Value 1

Or you can enable long path support via the Local Group Policy Editor (Win + R -> gpedit.msc -> OK ). Go to the following GPO section in the policy editor: Computer Configuration > Administrative Templates > System > Filesystem. Open the policy parameter named Enable Win32 long paths and set it to Enabled.

windows destination path too long

Save the changes and update local group policy settings.

In both cases, the computer needs to be rebooted to make changes to take effect. After a reboot, users and programs will be able to work without restrictions with files, which length of the path exceeds 256 characters. Now the files will only be affected by the NTFS file path limit of 32767 characters.

If you want to check if NTFS long path support is enabled on this computer, you can run the following PowerShell command:

Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled

If the command returned a value of 1, then the policy is enabled.

the destination path is too long

Keep in mind, that in order to use win32 NTFS long path, the application should be developed with this parameter enabled. As usually, such an option is enabled via the application manifest file.

An application manifest is a small file that contains some information about application compatibility, DPI support, etc. If applications are developed with NTFS long path support, then the longPathAware parameter must be added to the manifest file. For example:

<application xmlns=”urn:schemas-microsoft-com:asm.v3″>

<windowsSettings xmlns:ws2=”http://schemas.microsoft.com/SMI/2016/WindowsSettings”>

<ws2:longPathAware>true</ws2:longPathAware>

</windowsSettings>

</application>

In Visual Studio 2019 and MSBuild 16, this setting is enabled by default.

Win32 Long Paths GPO Not Working on Windows 10 File Explorer

There is bad news. File Explorer even in the latest builds of Windows 10 20H2 and Windows Server 2019 still doesn’t support NTFS long paths. This means that when you open such a file/folder, you will still receive the error: “Destination Path Too Long”.

Windows Explorer does not have a declaration in the manifest, and you will have to use one of the tricks described in this article to access long paths in Windows.

We saw the following comment from a Microsoft employee:

This feature is not ready for inclusion in File Explorer. You need to wait until Microsoft turns it on in Explorer, or use a third-party file management tool that is compatible with long paths.

However, in some applications, the MAX_PATH check is embedded in the code. About the max file path restrictions for .Net developers, see Solution 7 below.

Solution 6. Using Robocopy Command Line Tool to Copy and Move Files

You can use the built-in console Windows tool — robocopy to copy or move data. The utility allows you to correctly copy and synchronize files/directories with long paths.

For example, if you cannot delete the directory due to the path length limit, you can first move data from the directory using robocopy:

ROBOCOPY c:\folder1\folder2\folder3\longpath\ c:\tmp\ /MOVE /E

destination path too long fix

After that, you can delete the source directory:

Delete c:\folder1\folder2\folder3\longpath\ /q /f

Solution 7. Long File Path for .Net Developers

The Base Class Library (BCL) of the development environment for the .Net Framework has a built-in preliminary check for the admissibility of long directory and file names. Therefore .Net Framework developers may encounter a System.IO.PathTooLongException error in their programs.

Check for path length removed from BCL code in .Net Framework 4.6.2. Therefore, after updating the version of .Net Framework, developers can use long paths in the UNC path format (\\?C:\Very_long_path). When the LongPathsEnabled parameter is enabled in Windows 10/Windows Server 2016, it is possible to work correctly with files that have paths of almost any length.

To do this, use Net Framework 4.6.2 (and newer) when building applications, or for older app versions (.Net 4.0), use the following application configuration file:

<?xml version=”1.0″ encoding=”utf-8″?>

<configuration>

<startup>

<supportedRuntime version=”v4.0″ sku=”.NETFramework,Version=v4.0″/>

</startup>

<runtime>

<AppContextSwitchOverrides value=”Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false” />

</runtime>

</configuration>

Solution 8. Long File Path in PowerShell .Net Developers

PowerShell is based on .Net, and in order for the Get-Item, Get-ChildItem, Remove-Item, and other cmdlets to work correctly with long file paths, you need to upgrade the .NET Framework to 4.5 or newer and install Windows Management Framework 5.1.

Tip. The current version of PowerShell can be found in the variable $PSVersionTable.

After that, when using file cmdlets instead of Path, you need to use the LiteralPath parameter. For example:

Get-ChildItem -literalpath \\?C:\PS

the filename would be too long for the destination folder

Tip #1

There also is a great tool called “Long Path Tool” that works great to fix this, LongPath tool. However it isn’t free, the methods above are.

Tip #2

Thank you, Colin Albright, for the comment below. Yes, you can also use 7-zip or any zip utility to fix the Destination Path Too Long problem. Sometimes on single files, this could be a better and faster solution. Just zip the folder up, and your good to go.

Brian Jackson started this blog in 2011. Brian has a huge passion for WordPress and technology for over a decade. Brian enjoys blogging, movies, and hiking.

41 comments

  1. For this problem there is a quick and effective solution, called the Long Path Tool, solves the problem for sure.

    1. If you read all the way to the bottom, we actually put that in the post :) We agree, that tool is great! But some people might not want to pay the money to unlock it. Thank you for your comment!

      1. problem I have is saving mostly Excel files to nested SharePoint library folders. Combo of the file name and the path apparently exceeds the 256? character limit. What I don’t understand is why I can save the same Excel file to a local drive, then copy and paste it to that same SharePoint subfolder. Enabling long file name support does not help.

    1. Haha, yes 7-zip would definitely fix this problem as well :) In my example I was actually thinking more of entire directories containing hundreds of files. Yes, you could zip up the entire directory, but sometimes that takes a little longer. Depends on the size though. 7-zip definitely works great for single file copies though where this problem occurs.

      Thank you for commenting! I will add that as a user tip at the bottom of the post.

      1. Up to what size does it work with Zip?
        I need to copy the back up from the external hard drive unto the server.
        We tried the Zip method and it starts up and everything, but when it is done,
        you don’t find the Zip folder you created .

    2. Unfortunately I have found where 7-Zip states that the file path is too long and will not work.
      I even tried it on a single file that said the name was too long just to see what it would do. Any ideas for this?

  2. Thanks for commenting. We actually included that in our post towards the bottom. However some functionality of LongPathTool cost money. It is a great tool though! I use it quite often.

  3. A diff description of Brian’s nice solution.
    Just ‘map network drive’ the folder that contain the long file name file.
    In Win 8 it will map and auto open the folder.
    Delete the long named file
    Disconnect the temporary mapped folder

    1. Dude! I cannot change or remove or otherwise shorten path names. First of all there are THOUSANDS of them in the folder. Secondly there are apps in each of thousands of folders that require things be in the EXACT sub folder paths. A better solution would be for MICRO-CHEESE to give us a free application to move / copy / delete folders with long paths. After all they allowed us to create the paths in the first place. They created this problem by trying to make everything compatible with ancient versions of their OS. Then sit back and say “Working as intended” and make us buy third party applications to do what the OS should do by default????

      1. I have the same problem and I have, over the years, stored 2 GB of software. It may be possible to copy long paths using Teracopy, but the last time I moved a long path, I used 7zip and just stored files in the folder with zero percent compressing into a 7zip file , then copied the whole 7zip file to the drive I wanted and unzip it. Worked for me.

  4. Will using long path tool solve copy and paste issues on the fly? for example, if my copy and paste has 900 paths too long, do I need to manually find them and copy them with long path tool, or is it fixed on the fly?

  5. If you fell any problem to do copy,paste,error Deleting File or Folder.Then you should use Long Path Tool to solve your problem.
    If Long Path Tool fails on start up, please ensure you have .net framework installed on your PC.

  6. Seriously? I can’t move a huge 500GB folder that contains years worth of data because the path names are to long? Seriously MS? What a piece of shit operating system. Who the hell would make an OS that allows you to create the paths in the first place. Have apps that now require those EXACT pathnames. Then disallow you from moving the folder because you stuck an arbitrary fixed pathname length in ancient versions of you OS (or should I say your VIRUS that you call an OS)? You created this ridiculous problem why the hell not gives us a free solution to it? I refuse to PAY for a third party application to do something that any stable reliable modern OS should be capable of doing!!!!!!

    1. In 2020, There is a tool that we use that can handle long pathnames problem called gs richcopy 360, it was the best choice for us in such a case

  7. I used to have similar problems too, but after using “long path tool” everything was solved. Try this software and you would be glad you did.

  8. I am getting this same issue, i guess the best thing to do is to use a
    third party app like Long Path Tool. Just download it and use it to
    solve this issue. I hope this would help.

  9. Just use RoboCopy, that’s what we use. Free, works great. I use the GUI, but you can just use it at the command line as well.

  10. Alternatively, you can use GS Richcopy 360, it also works for such problems. It supports long path names and fully copies and moves files and folders exceeding 260 characters in length. I have been using it since one year ,and it is one of the best copying software I have ever come across.

  11. Some of you here are saying try long path tool but why to try something dedicated to just one problem. It does not solve slow transfer rate nor will provide you email notification when your transfer/backup is done. I would suggest to try GS Richcopy 360. It worked for me and for my enterprise. Give it a try!

  12. I use GS RichCopy360. It supports long file names and also can copy locked/open files with ease. Though it’s not cheap, it is a great tool for copying files from one machine to another or to different directives on the same machine.

  13. This is one of the most embarrassing issues in windows. Th most important app in windows, explorer, still doesn’t supports long paths.

    I’ve been using linux for the past 12 years and a few months ago I said let’s give windows 10 a try. All these years, I’ve got more than 14TB of files and a lot of them were inaccessible because of this.

    These “solutions” are not real solutions but workarounds. If it happens to be a developer and Linux user with countless files like me then good luck with those “solutions”.

    In 2018, you still pay hundreds of bucks for an OS that wants to be compatible with 90s.

    Windows is defective by design.

    Anyway, this article is the most accurate I’ve found on the web for this issue!

  14. thanks a lot bro, I had to many problems with migrations and personal files and now i have to say a big THANK YOU!!!!

  15. Modifying “LongPathsEnabled” in the Registry Editor did not work. I changed the Value Data to 1 from 0 and clicked OK. I restarted, double checked that it remained at 1 and then copied one of the folders to the same destination. I still got the same “Destination Path Too Long” dialogue. Is it because I am copying this to an external HD and that this function doesn’t apply to the drive?

    I have 2.9 TB of files I need to copy to a drive and there are about 100 folders that won’t copy unless I manually search for them and change the directory to each one. I don’t understand why we have to pay $39 for a tool to accomplish this simple task. This is why so many people would rather spend extra money to get a Mac. That extra money gets recovered because there’s a lot less non-billable time spent and less IT support is required.

    1. @Mike: No, the solution suggested will only work for Windows applications that don’t specify the MAX_PATH variable in the programming codes, which is limited to 255 Latin characters, like Windows Explorer! So, Windows Explorer will NEVER work despite the registry’s mod and the group policy’s mod.

      The workaround that doesn’t cost you a dime if you use Android/Linux is:
      1. Root Explorer (Android free application)
      2. BlueStacks (Android free emulator for Windows)
      3. Any Android device that supports SAMBA network connection.

      One workaround I used is running an Android file manager like Root Explorer, etc and make a SAMBA share/connection to the Windows 10 computer. Then, from the Android file manager, I can rename any Latin and/or Unicode file names via the SAMBA share, without suffering the file’s limitation issue exhibited by Windows Explorer itself!

      Another solution would be to install an Android emulator for Windows like Bluestacks, etc and run an Android file manager like Root Explorer, etc and rename Windows’ files with long names without any problems with file name’s length. Again, Android/Linux comes to the rescue!

  16. Hi there;

    Hmmm, been trying this ”fixes” but it really doesn’t work for Dj’s that have Gigabytes of files (mp3, wav etc).
    Does anybody knows something much more ”easy, quicker”???

    Thank you kindly for your time;0

    Marlon

  17. This case is extremely easy now, you can just try any free or paid tool to do this and you have Long path tool, GoodSync, Gs RichCopy 360, and Teracopy as examples, you can make a search

  18. The real question is why such a ridiculous shortcoming was implemented in Windows to begin with — the whole point of filenames and pathnames is to structure and label data sufficiently to be human-understandable. Limiting pathnames has ALWAYS been unacceptable is is shameful for MicroSoft to have done.

  19. One workaround I used is running an Android file manager like Root Explorer, etc and make a SAMBA connection to the Windows 10 computer. Then, from the Android file manager, I can rename any Latin and/or Unicode file names that is longer than the 255 characters’ limitation – issue exhibited by Window Explorer. Android is built on top of Linux so it doesn’t have this limitation like the Windows Explorer application in Windows 10!

    Another solution would be to install an Android emulator for Windows like Bluestacks, etc and run an Android file manager like Root Explorer, etc and rename Windows’ files with long names without any problems with file name’s length. Again, Android/Linux comes to the rescue!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.