Posts Tagged ‘.net’

Working around System.IO.PathTooLongException in .NET

July 1, 2012

I am working on a file-and-directory processing utility that iterates through very large filesystem structures and came across the dreaded System.IO.PathTooLongException when trying to create a DirectoryInfo object on a file path that was greater than 260 characters, the System.IO ANSI limit.

A quick search located the Delimon.Win32.IO library, built for the 4.0 framework. This library allows you to work with file paths up to 32K in length – hopefully way more than enough for any purpose!