hi sir,
i have to write code regarding to my hard drive.
if hard disk space consumed is greater than 90% then there should be a message send to my mobile number that your hard drive space consumed up to 90%.
can u help me by doing this?
my code is attached below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication35
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GetTotalFreeSpace("E:\\");
}
private void GetTotalFreeSpace(string driveName)
{
System.IO.DriveInfo dDrive = new System.IO.DriveInfo(driveName);
if (dDrive.IsReady)
{
double freeSpacePerc = (dDrive.AvailableFreeSpace / (float)dDrive.TotalSize) * 100;
Response.Write(string.Format("<br/>Free space: {0}", dDrive.AvailableFreeSpace));
Response.Write(string.Format("<br/>Total space: {0}", dDrive.TotalSize));
Response.Write(string.Format("<br/>Percentage free space: {0:0.00}%.", freeSpacePerc));
}
}
}
}