Long path file successfully copied but cannot open in Windows 10
I wanted to copy files from a Windows 7 Machine to a Windows 10 Machine and used Network transfer via LAN, however, I wasn't able to copy all the data because I received an error at the end:
Destination Path Too Long
--- The file name(s) would be too long for the destination folder...
I researched and found this site, and after doing the workaround on that site, I was able to copy all the remaining data, however, when I tried to open these files from the Windows 10 Machine another error appeared, with the file location becoming: \\\?D:\Users\Username\Desktop\Super\Long\Path\Filename...
- The file location is not complete.
- The files are not corrupted and can still be opened if I try to shorten the path.
Question: Is there a way to open a file with long path in Windows 10 without shortening the path?
Solution 1:
The syntax your are seeing is the UNC naming convention used in Windows to specify long names.
The syntax to use is : \\?\D:\very long path
.
If this information is not enough, please specify what utility you are using for doing the copy, as not all utilities may accept long path names.
To my great surprise I find that Windows is not ready for such long path names, in spite of what the documentation says.
I tried to duplicate the path used by the poster:
\?\D:\Users\akash\Desktop\PS-19001F SDU Foundation suction piles, UTA suction piles and Mudmat\0. Before Award\KOM DOCUMENTS SOW Emails Etc\on 12 03 2019 email dates from tfmc for tendering\078072c003-ptti-eni-merakes epci-2\Exhibit B\Appendix B.1.2-Breakdown for Structural Material
Here is what happened:
- I found that Windows Explorer refused to create this path, and the failure happened on the last sub-folder.
- I did manage to create the last sub-folder from PowerShell using
mkdir
- Explorer agreed to display the folder, but refused to copy any file into it
- Again I used the PowerShell Copy-Item command for that
- Explorer only displayed the file after I pressed F5, but then refused a double-click with the message "The directory name is invalid".
- I tried to open files in the last sub-folder using Foxit Reader,
Adobe Acrobat and Microsoft Office. In all of them the syntax of
\\?\D:\
was refused, so I had to build up to it sub-folder after sub-folder using the `D:\" syntax, to find out finally that the document couldn't be opened. - For clincher, when I deleted in Explorer the folder of
D:\Users
, I got the message that the path-name was too long for the Recycle Bin.
The only solution that worked was to shorten the path by using in the Command Prompt (cmd) the subst command like this:
subst Z: "D:\Users\akash\Desktop\PS-19001F SDU Foundation suction piles, UTA suction piles and Mudmat"
I could now refer to files inside the virtual Z:
drive without any problem.
Conclusion: Windows and its applications are not really ready for using long path names. The path-name must be shortened to really be usable.