Get free disk space in C#
To get All disks free space in C#, first we need to get All drivers as Driver info objects and then callTotalFreeSpace
property.Example
using System;
using System.IO;
public class Program
{
public static void Main()
{
foreach (DriveInfo drive in DriveInfo.GetDrives())
{
Console.WriteLine( drive.TotalFreeSpace);
}
}
}