Answers for "c# get free space on drive"

C#
1

c# get free space on drive

using System.IO;

private long GetTotalFreeSpace(string driveName)
{
    foreach (DriveInfo drive in DriveInfo.GetDrives())
    {
        if (drive.IsReady && drive.Name == driveName)
        {
            return drive.TotalFreeSpace;
        }
    }
    return -1;
}
Posted by: Guest on July-30-2020

C# Answers by Framework

Browse Popular Code Answers by Language