diff --git a/PeyrSharp.Env/FileSys.cs b/PeyrSharp.Env/FileSys.cs index a073347..28c7442 100644 --- a/PeyrSharp.Env/FileSys.cs +++ b/PeyrSharp.Env/FileSys.cs @@ -187,5 +187,19 @@ public static DriveInfo DriveWithLowestFreeSpace return drives.OrderBy(x => x.TotalFreeSpace).First(); // Return the drive with the lowest free space } } + + /// + /// Gets the drive with the higest free space available. + /// + /// A value, which contains the information of the drive. + public static DriveInfo DriveWithHighestFreeSpace + { + get + { + var drives = DriveInfo.GetDrives(); // Get all drives + drives = drives.Where(x => x.DriveType != DriveType.CDRom).ToArray(); // Remove CD-ROM + return drives.OrderByDescending(x => x.TotalFreeSpace).First(); // Return the drive with the highest free space + } + } } }