Click here to Skip to main content
15,917,628 members
Home / Discussions / C#
   

C#

 
GeneralRe: Load C# windows applcation from windows service Pin
Rampas Tomas15-Dec-03 0:14
Rampas Tomas15-Dec-03 0:14 
GeneralRe: Load C# windows applcation from windows service Pin
JeyKey15-Dec-03 0:27
JeyKey15-Dec-03 0:27 
GeneralGUI Pin
G_ULJEE14-Dec-03 20:59
G_ULJEE14-Dec-03 20:59 
GeneralGDI+ Graphics.DrawRectangle() Pin
krisp14-Dec-03 20:33
krisp14-Dec-03 20:33 
GeneralRe: Drawing rectangles in GDI+ Pin
Arun Reginald Zaheeruddin14-Dec-03 23:28
Arun Reginald Zaheeruddin14-Dec-03 23:28 
GeneralWBEM not WMI Pin
WayneMJ14-Dec-03 18:42
WayneMJ14-Dec-03 18:42 
GeneralGet Folder Attributes Pin
Daniel Negron14-Dec-03 14:57
Daniel Negron14-Dec-03 14:57 
GeneralRe: Get Folder Attributes Pin
Rampas Tomas14-Dec-03 20:57
Rampas Tomas14-Dec-03 20:57 
You can obtain number of files and folders from instance of DirectoryInfo class. According to me the size of folder you will have to count yourself.
For example:
<br />
using System;<br />
using System.IO;<br />
<br />
namespace size<br />
{<br />
  class Class1<br />
  {<br />
    [STAThread]<br />
    static void Main(string[] args)<br />
    {<br />
      DirectoryInfo dir = new DirectoryInfo(@"C:\Sybila");<br />
      long size = 0;<br />
      size += GetSizeOfDirectory(dir);<br />
      Console.WriteLine(String.Format("Size of folder {0}", size));<br />
    }<br />
<br />
    protected static long GetSizeOfDirectory(DirectoryInfo dir)<br />
    {<br />
      long ret = 0;<br />
      foreach(FileInfo fi in dir.GetFiles())<br />
      {<br />
        ret += fi.Length;<br />
      }<br />
      foreach(DirectoryInfo di in dir.GetDirectories())<br />
      {<br />
        ret += GetSizeOfDirectory(di);<br />
      }<br />
      return ret;<br />
    }<br />
  }<br />
}<br />

You would obtain the physical size on the disk with WMI...

Tomas Rampas
------------------------------
gedas CR s.r.o.
System analyst, MCSD
TGM 840,
293 01 Mlada Boleslav,
Czech Republic
Telefon/phone +420(326)711411
Telefax/fax +420(326)711420
rampas@gedas.cz
http://www.gedas.com/
------------------------------

To be or not to be is true...
George Bool


GeneralHelp Regarding Image Transfer Pin
Ali Gohar14-Dec-03 9:24
sussAli Gohar14-Dec-03 9:24 
GeneralRe: Help Regarding Image Transfer Pin
Heath Stewart15-Dec-03 4:18
protectorHeath Stewart15-Dec-03 4:18 
GeneralHeath - Further External Drag Drop Questions Pin
Tristan Rhodes14-Dec-03 6:42
Tristan Rhodes14-Dec-03 6:42 
GeneralRe: Heath - Further External Drag Drop Questions Pin
Nick Parker14-Dec-03 7:22
protectorNick Parker14-Dec-03 7:22 
GeneralRe: Heath - Further External Drag Drop Questions Pin
Tristan Rhodes14-Dec-03 12:10
Tristan Rhodes14-Dec-03 12:10 
GeneralRe: Heath - Further External Drag Drop Questions Pin
Heath Stewart15-Dec-03 4:13
protectorHeath Stewart15-Dec-03 4:13 
GeneralRe: Heath - Further External Drag Drop Questions Pin
Tristan Rhodes15-Dec-03 6:59
Tristan Rhodes15-Dec-03 6:59 
GeneralRe: Heath - Further External Drag Drop Questions Pin
Heath Stewart15-Dec-03 8:27
protectorHeath Stewart15-Dec-03 8:27 
GeneralRe: Heath - Further External Drag Drop Questions Pin
Tristan Rhodes15-Dec-03 8:58
Tristan Rhodes15-Dec-03 8:58 
GeneralRe: Heath - Further External Drag Drop Questions Pin
Heath Stewart15-Dec-03 9:00
protectorHeath Stewart15-Dec-03 9:00 
GeneralRe: Heath - Further External Drag Drop Questions Pin
Tristan Rhodes15-Dec-03 10:15
Tristan Rhodes15-Dec-03 10:15 
GeneralRe: Heath - Further External Drag Drop Questions Pin
J. Dunlap15-Dec-03 11:11
J. Dunlap15-Dec-03 11:11 
GeneralNever mind... Pin
J. Dunlap15-Dec-03 11:14
J. Dunlap15-Dec-03 11:14 
GeneralRe: Never mind... Pin
Tristan Rhodes15-Dec-03 11:16
Tristan Rhodes15-Dec-03 11:16 
GeneralRe: Never mind... Pin
Tristan Rhodes15-Dec-03 11:33
Tristan Rhodes15-Dec-03 11:33 
GeneralRe: Never mind... Pin
J. Dunlap15-Dec-03 11:43
J. Dunlap15-Dec-03 11:43 
GeneralRe: Never mind... Pin
Tristan Rhodes15-Dec-03 11:52
Tristan Rhodes15-Dec-03 11:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.