Skip to content
Auto
Products

Windows drive (WinDrive)

TagBites.IO.WinDrive mounts any DirectoryLink - local, FTP, ZIP, virtual, or any other TagBites.IO file system - as a real Windows drive letter, backed by Dokan. This lets ordinary Windows applications (Explorer, Office, …) work with the directory as if it were a regular disk.

Requires the Dokan driver to be installed on the target machine, and targets net6.0-windows.

var directory = FileSystem.Local.GetDirectory("D:/Files");
using var drive = new WinDrive(directory)
{
Name = "My Drive",
IsReadOnly = false,
IsSingleThread = false,
IsNetworkDrive = false
};
drive.Mount();
// ... drive is now available, e.g. as "V:\"
drive.Dismount();
MemberDescription
NameDrive label shown in Windows.
MountPointDrive letter (e.g. "V:\\") or an NTFS folder path to mount into. If not set, "V:\\" is used, falling back to the first free letter from Z down.
IsReadOnlyMounts the drive with write protection.
IsSingleThreadProcesses Dokan events on a single thread. Not recommended - can easily become a bottleneck.
IsNetworkDriveMounts as a network drive instead of a removable/fixed disk.
AccessDenyFilesA WinDriveAccessDenyFileCollection of file/name patterns that should be hidden from the drive (e.g. Thumbs.db, desktop.ini). Use AddWindowsFiles() and AddCodeFiles() to add common presets (Windows shell files, .git, etc.).
AccessDenyProcessesA WinDriveAccessDenyProcessCollection of process names that are denied access to the drive (e.g. to keep a syncing client like Dropbox from touching it).
IsMountedGets whether the drive is currently mounted; setting it calls Mount()/Dismount().

Since WinDrive accepts any DirectoryLink, it can be combined with a virtual file system to expose several sources merged into one drive:

var directory1 = FileSystem.Local.GetDirectory("D:/TestFiles");
var directory2 = FileSystem.Local.GetDirectory("D:/OtherFiles");
var virtualDirectory = new VirtualDirectory
{
Entries =
{
new VirtualDirectoryEntry(directory1, "a"),
new VirtualDirectoryEntry(directory2, "b")
}
};
using var drive = new WinDrive(virtualDirectory.ToDirectory()) { Name = "Merged Drive" };
drive.AccessDenyProcesses.Add("dropbox");
drive.AccessDenyFiles.AddWindowsFiles().AddCodeFiles();
drive.Mount();

Full implementation on github: TagBites.IO.WinDrive.