Suppose there is a shared drive.

Is it possible to find out how much free space is left on the disk where the shared disk is located?

1 answer 1

Here is an example with DriveInfo:

using System; using System.IO; class Info { public static void Main() { DriveInfo[] drives = DriveInfo.GetDrives(); foreach (DriveInfo drive in drives) { //There are more attributes you can use. //Check the MSDN link for a complete example. Console.WriteLine(drive.Name); if (drive.IsReady) Console.WriteLine(drive.TotalSize); } } }