Getting Free space on your hard Drive:
let's create a simple console application that out put free space of hard drive.
Step 1:
Start a new console application in C sharp.
Step 2:
Type the following code to get a drive char from user;
Console.WriteLine("Please enter a Drive character : ");
Step 3:
Type the following code to get the memory information;
System.IO.FileInfo f_info = new System.IO.FileInfo(a);
Step 4:
Type the following code to get the Name of Drive;
System.IO.DriveInfo d_info = new System.IO.DriveInfo(f_info.FullName);
Step 5:
Type the following code to get the available free space on Drive;
Console.WriteLine(d_info.AvailableFreeSpace.ToString());
Final Step:
Over all code is as bellow.
let's create a simple console application that out put free space of hard drive.
Step 1:
Start a new console application in C sharp.
Step 2:
Type the following code to get a drive char from user;
Console.WriteLine("Please enter a Drive character : ");
string a = Console.ReadLine();
Type the following code to get the memory information;
System.IO.FileInfo f_info = new System.IO.FileInfo(a);
Step 4:
Type the following code to get the Name of Drive;
System.IO.DriveInfo d_info = new System.IO.DriveInfo(f_info.FullName);
Step 5:
Type the following code to get the available free space on Drive;
Console.WriteLine(d_info.AvailableFreeSpace.ToString());
Final Step:
Over all code is as bellow.
Console.WriteLine("Enter andy Char:");
string a = Console.ReadLine();
System.IO.FileInfo f_info = new System.IO.FileInfo(a
+ ":");
System.IO.DriveInfo d_info = new System.IO.DriveInfo(f_info.FullName);
Console.WriteLine(d_info.Name);
Console.WriteLine(d_info.AvailableFreeSpace.ToString());
Console.ReadLine();











































