Where would you like to go, Toady? RSS 2.0
# Friday, April 16, 2010
   1:   
   2:  using System;
   3:  using System.IO;
   4:     
   5:  namespace EnumerateDrives
   6:  {
   7:      class Program
   8:      {
   9:          static void Main(string[] args)
  10:          {
  11:              var drives = DriveInfo.GetDrives();
  12:              foreach (var drive in drives)
  13:              {
  14:                  try 
  15:                  {
  16:                     Console.WriteLine(String.Format("{0}: totalspace:{1}gb free:{2}gb", 
  17:                          drive.Name, 
  18:                          drive.TotalSize/1024/1024/1024,
  19:                          drive.TotalFreeSpace/1024/1024/1024));
  20:                  }
  21:                  catch(Exception ex)
  22:                  {
  23:                      Console.WriteLine(ex.Message);
  24:                  }
  25:              }
  26:              Console.ReadKey();
  27:          }
  28:     }
  29:  }
Friday, April 16, 2010 2:06:22 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
Bookmark, Tweet, or Share
Stackoverflow.com Rep
Flickr stream
Archive
<April 2010>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Chris Ballance
Sign In
Statistics
Total Posts: 46
This Year: 12
This Month: 0
This Week: 0
Comments: 11
All Content © 2010, Chris Ballance

Valid XHTML 1.0 Transitional