public UInt64 GetFreeDiskSpace(String folderPath) { if (folderPath == null) { throw new ArgumentNullException("folderPath"); } SetupLogger.LogInfo("GetFreeDiskSpace"); SetupLogger.LogData("Folder Path: ", folderPath); UInt64 freeBytes = 0; UInt64 totalBytes = 0; UInt64 totalfreeBytes = 0; String validFolderPath = PathHelper.GetExistingAncestor(folderPath); InstallLocationValidation.GetDiskFreeSpace(validFolderPath, ref freeBytes, ref totalBytes, ref totalfreeBytes); // Convert the bytes in Megabytes freeBytes = freeBytes / (UInt64)Math.Pow(2, 20); SetupLogger.LogData("FreeSpace: ", freeBytes.ToString()); return(freeBytes); }