In my project RoboPowerCopy (http://robopowercopy.codeplex.com) I’ve implemented a basic set of classes and methods for use with files and directories with long paths. NTFS supports paths with up to 32000 characters. But .NET only supports 256 characters. So System.IO.FileInfo and System.IO.DirectoryInfo will not work with such a file:
c:usersikarsteinappdatalocal111112222233333444445555566666777778888899999000001111122222333334444455555666667777788888999990000011111222223333344444555556666677777888889999900000111112222233333444445555566666777778888899999000001111122222333334444455555666667777788888999990000011111222223333344444555556666677777888889999900000111112222233333444445555566666777778888899999000001111122222333334444455555666667777788888999990000011111222223333344444555556666677777888889999900000111112222233333444445555566666777778888899999000001111122222333334444455555666667777788888999990000011111222223333344444555556666677777888889999900000hello.txt
This path has 655 characters. No way in .NET without using the Win32 API.
I’ve wrapped the API calls into a set of basic .NET classes to provide a basic support for files and directors with long paths…
Here it is: http://longpathsupport.codeplex.com
Please feel free to contribute the project or post you experiences on my blog or on Codeplex!
For the project I’ve read/used some other source in the Internet. Especially this three I’d like to refer to:
- Dave Midgley talking about “Reparse Points in Vista”: http://www.codeproject.com/KB/vista/ReparsePointID.aspx
- “NTFS Hard Links, Directory Junctions, and Windows Shortcuts”: http://www.flexhex.com/docs/articles/hard-links.phtml
I had the similar problem and tried Long Path Tool, available at http://www.pathtoodeep.com/. It helped me to solve this problem easily. Try it, and you will definitely love this tool. Its free.