System.IO getting you down with the MAX_PATH Blues? AlphaFS 2.0!

Sign in to queue


Today's project is one that I've been following years and have used a number of times. It helps you solve what has started to become an issue, MAX_PATH...

While NTFS supports folder paths up to 32K long, Windows and .NET have yet to expose that, instead keeping with the legacy MAX_PATH length, 260 characters. And let me tell you, 260 isn't what it used to be...

There are WinAPI's that you can use via PInvoke, but before you go there, maybe someone else has already done the heavy lifting?



The file system support in .NET is pretty good for most uses. However there are a few shortcomings, which this library tries to alleviate. The most notable deficiency of the standard .NET System.IO is the lack of support of advanced NTFS features, most notably extended length path support (eg. file/directory paths longer than 260 characters).

Feature Highlights
  • Support for extended length paths (longer than 260 characters)
  • Creating Hardlinks
  • Accessing hidden volumes
  • Enumeration of volumes
  • Transactional file operations
  • Support for NTFS Alternate Data Streams
  • Accessing network resources (SMB/DFS)
  • …and much more!

What does AlphaFS provide?

AlphaFS provides a namespace (Alphaleonis.Win32.Filesystem) containing a number of classes. Most notable are replications of the System.IO.File, System.IO.Directory and System.IO.Path, all with support for the extended-length paths (up to 32000 chars), recursive file enumerations, native backups and manipulations with advanced flags and options. They also contain extensions to these, and there are many more features for several functions.

Another thing AlphaFS brings to the table is support for transactional NTFS (TxF). Almost every method in these classes exist in two versions. One normal, and one that can work with transactions, more specifically the kernel transaction manager. This means that file operations can be performed using the simple, lightweight KTM on NTFS file systems, through .NET, using the interface of the standard classes we are all used to.

AlphaFS also contains some NTFS security related functionality (in Alphaleonis.Win32.Security), providing the ability to enable token privileges for a user, which may be necessary for eg. changing ownership of a file.

The library is Open Source, licensed under the MIT license.

AlphaFS 2.0 is Out!

Excited about your latest masterpiece, but filled with anger and fear when you find out that a .NET path can still be too long for your app.

So, this is exactly how I felt, mostly angry.

I had written the best next-gen-file-explorer only to find out that it kinda sucked when I reached that dreaded PATH TOO LONG error.

Just as you did, I searched the net and searched the net and searched until I came across AlphaFS 1.5.

Wohoo! I was SO happy to see that people actually had put together this marvelous library
that in the end my next-gen became old-skool because I completely abandoned it and totally focused on AlphaFS.

The result of that is presented here today!

We are proud to present to you version 2.0 of AlphaFS.

“When the Path is too long, one’s journey may end.
Observing the First, as Alpha moves on.”


Highlights of version 2.0
  • AlphaFS is now distributed primarily at NuGet.
  • Because of major inspiration, some backward compatibility may have been broken. Forgive us for this, but we’re sure you’ll quickly recover.
  • Implementations of major .NET classes (File, Directory and Path, …) up until .NET 4.5.
  • Implemented a brand new file systems enumerator.
  • Added support for working with files and folders with a trailing dot or space.
  • Added support for AlternateDataStreams.
  • Added support for accessing network resources, like SMB and DFS shares.
  • The repository was moved to GitHub, to allow for third party developers to more easily contribute to the library.


The source is available and there's even doc's!


In short, this System.IO replacement will help you break away from MAX_PATH, nevering worrying about it again...

Also it's important to note that AlphaFS works great with PowerShell. Check this out for more details,


Page thumbnail Io curtsey of Forsetius (Get it? Io as in System.Io... ;)

The Discussion

  • User profile image
    Andreas Kroll

    Hi Greg!

    Awesome stuff. I recently had the problem of not being able to access an absolute path due to the length restriction of the .NET frameworks classes.
    At first I could not believe it, since Windows is able to provide longer paths for ages and I could not think of any reason why this should be hidden in .NET.

    Then I found out that you still can use the classes of .NET if you prevent using absolute paths. You can navigate using the relative navigation.

    But the solution of AlphaFS is the much better way to go.
    I will gladly use it in my apps.

    Thanks for sharing!

    Best regards,

  • User profile image

    Why don't you try Long Path Tool

  • User profile image

    @Paulina: This is a library/DLL that let's programmers build app's that support Long Paths... 

  • User profile image
    corey Lawne

    Open source library! sounds cool to me. Earlier I didn't knew about this stuff so I used GS Richcopy 360 which helped me solve this problem. Its a robust software and very effective in solving errors related to file transfer. I would try your solution too, sometime maybe!

Add Your 2 Cents