AlphaFS – Bringing Advanced Windows File System support to .NET

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 file system support was discovered in my attempts to work with the Windows Volume Shadow Copy Service (VSS) (See my previous posts).

VSS creates snapshots of volumes, but on Windows XP does not allow exposing this snapshot as a standard drive letter.  There is a hack using the CreateDosDevice Win32 API function, but the solution is not very elegant.

Exposing drive letters works on Windows Vista and later, but it may not be desireable from eg. a backup application, to suddenly have a number of new drive letters turn up in explorer.

The paths through which the shadow copies are available are some internal naming scheme Windows uses (which I have yet to find a name for, do you know it?) which looks like eg. "\\?\Volume{12345678-aac3-31de-3321-3124565341ed}\Program Files"  instead of simply "C:\Program Files".

However, these paths cannot be accessed using the file system functions exposed by System.IO.

The Win32 API functions can however, so my first thought was to simply create a small class exposing these functions through standard p/invoke for the most important functions I needed, such as CopyFile, MoveFile, FindFirstFileEx and so on. However, it quickly becomes a hassle to work directly with these functions, and one thing led to another and finally I created this library.

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 internal windows paths discussed above. They also contain extensions to these, and there are more options for several functions.

Another thing AlphaFS brings to the table is support for transactional NTFS (TxF). You can read a good introduction to that here. 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 a little 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.

This is an alpha release, and it is likely to contain bugs, and interfaces may change as the library evolves.

The library comes with full API documentation in CHM and Windows Help 2.x format.

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

AlphaFS with documentation can be downloaded from the Downloads page.

I am very interested in receiving feedback on this, so please leave a comment if you use the library, find bugs, have suggestions or have anything in general at all to say about it.


  1. Hi There! I have the same problem as Darren had in the first post, the error about illegal path. That trac link seems to be down. Can i download it from somewhere else?

    Kind Regards,
    And Great Job!

  2. Thanks for your help, I have used the FileSystemEntryEnumerator and that worked a treat. I couldn’t use Directory.GetFileSystemEntries as that returns a string[] of the names, not the file sizes. But I got there in the end. Many thanks for your help — I’ve no idea why you had to go to the both of creating this library as the core .net libraries should not prevent access to these types of internal names.

  3. Ah, I see there is actually no “simple” way to get the filesize. At the moment however, the file size is available from the FileSystemEntryInfo structure, which means you could use the FileSystemEntryEnumerator or the Directory.GetFileSystemEntries (passing the directory and the filename that you want) to retrieve the size of the file you are interested in.

    Granted this is not very elegant, and I will look into adding FileInfo to the library. But for now, the FileSystemEntryInfo should be able to solve your problem.

  4. Hi, I think the only one that I need that isn’t on the File class is the FileInfo.Length Property. This maybe available elsewhere, but I haven’t found it if it is.

  5. FileInfo and DirectoryInfo are currently not implemented. What functionality from that class do you need that is not available through the File or Directory classes?

  6. Hello again, do you have an equivalent to System.IO.FileInfo? I need one that works with a Shadow copy volume.

  7. Hi, The VSS library looks excellent, exactly what I’m looking for however I am having problems trying to call the following:


    where the “prop.SnapshotDeviceObject” equals “\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy13” — I get an IllegalPathException exception in the method “GetFilesOrDirectoriesInternal” due to the path containing a “?”. If I skip this check then “MatchUniqueRoot” will fail with IllegalPathException as the GLOBALROOT isn’t tested for. If I use “\\?\Volume{ec7221a7-7725-11dd-8ad9-806e6f6e6963}\” in GetFiles then I get a “DirectoryNotFoundException”, can you help?

Comments are closed.