I am trying to find especially large files on a file share with deeply nested folders. They aren't my folders, so I don't get to rearrange them. The usual way to get the length of a file is:
string fullPath = "C:\path\file.ext";
FileInfo info = new FileInfo(fullPath);
long len = info.Length;
If the length of the path is greater than 260 characters, the FileInfo constructor throws a PathTooLongException. I've read the Kim Hamilton blog entries on long file paths in .NET, so I know it can be done if I ditch the framework and do it all with Win32 API calls. Is there a way to do it with the framework?
Kim Hamilton blog entries on long file paths in .NET:
Part 1
Part 2
Part 3