Windows
Destination path too long fix (when moving/copying a file): 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 in Windows, try the quick trick below. The reason you receive the error is that File Explorer failed to copy/delete/rename any pathname longer than 256 characters. This is not the limitation of the NTFS file system, but the Win32 API library. In Win32 API the MAX_PATH value is 260. When you try to access file I/O on a specific path, the Windows API always checks if the path is longer than the MAX_PATH limit. Solution 1. Rename Parent Folder to Decrease the Full Path: ------------------------------------------------------------ The simplest way is to shorten the name of the parent folders, by reducing the total path length by simply renaming it. This workaround is not always applicable. Solution 2. Create a Symbolic Link ----------------------------------- mklink /d c:\homelink “C:\verylongpathhere……” Solution 3. Use Subst Utility ------------------------------ Subst Z: “C:\verylongpathhere……” Note : you can delete the virtual disk using the Subst with the /d option: --------------------------------------------------------------- Subst Z: /d Solution 4. Hidden Share Path : -------------------------------- Solution 5. How to Enable Win32 Long Path in Windows? ------------------------------------------------------ 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. You can change this registry parameter with the following PowerShell command: ----------------------------------------------------------------------------- Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem -Name LongPathsEnabled -Value 1 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 Solution 6. Using Robocopy Command Line Tool to Copy and Move Files robocopy to copy or move data. The utility allows you to correctly copy and synchronize files/directories with long paths. ------------------------------------------------------------------------------------------------------------------------- ROBOCOPY c:\folder1\folder2\folder3\longpath\ c:\tmp\ /MOVE /E After that, you can delete the source directory: Delete c:\folder1\folder2\folder3\longpath\ /q /f Solution 7. Long File Path for .Net Developers Solution 8. Long File Path in PowerShell .Net Developers -------------------------------------------------------- Get-ChildItem -literalpath \\?\C:\PS Solution 9. Use 7-Zip to Perform File Operation with Long File Path Tip #1 There also is a great tool called “Long Path Tool” that works great to fix this. 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 you are good to go. https://theitbros.com/destination-path-too-long-error-when-movingcopying-a-file/