using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace DirList
{
class Test
{
public static void Main()
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo dirInfo in allDrives)
{
Console.WriteLine("Drive {0}", dirInfo.Name);
Console.WriteLine("File type: {0}", dirInfo.DriveType);
if (dirInfo.IsReady == true)
{
Console.WriteLine("Volume label: {0}", dirInfo.VolumeLabel);
Console.WriteLine("File system: {0}", dirInfo.DriveFormat);
Console.WriteLine("Available space:{0, 15} bytes", dirInfo.AvailableFreeSpace);
Console.WriteLine("Total available space: {0, 15} bytes", dirInfo.TotalFreeSpace);
Console.WriteLine("Total size:{0, 15} bytes ",dirInfo.TotalSize);
Console.WriteLine("\n");
}
}
Console.Read();
}
}
}
No comments:
Post a Comment