Root Directory

image_pdfimage_print
   
  

using System;
using System.IO;

class MainClass {
    static void Main(string[] args) {
        if (args.Length == 1) {
            DriveInfo drive = new DriveInfo(args[0]);

            Console.Write("Free space in {0}-drive (in kilobytes): ", args[0]);
            Console.WriteLine(drive.AvailableFreeSpace / 1024);
            return;
        }

        foreach (DriveInfo drive in DriveInfo.GetDrives()) {
            Console.WriteLine("{0} - {1} KB",drive.RootDirectory,
                    drive.AvailableFreeSpace / 1024
                    );
        }
    }
}

   
     


This entry was posted in File Stream. Bookmark the permalink.