how to find the disk space of a drive in Windows Services
-
hi all, I am working on a Windows Services where i need to find the disk space of C: drive.Is it possible? Can u plz give some suggestions.. Thanks in advance,
cheers sangeet
-
hi all, I am working on a Windows Services where i need to find the disk space of C: drive.Is it possible? Can u plz give some suggestions.. Thanks in advance,
cheers sangeet
Give score if it worths for you. ================================ DriveInfo[] allDrives = DriveInfo.GetDrives(); foreach (DriveInfo d in allDrives) { Console.WriteLine("Drive {0}", d.Name); Console.WriteLine(" File type: {0}", d.DriveType); if (d.IsReady == true) { Console.WriteLine(" Volume label: {0}", d.VolumeLabel); Console.WriteLine(" File system: {0}", d.DriveFormat); Console.WriteLine( " Available space to current user:{0, 15} bytes", d.AvailableFreeSpace); Console.WriteLine( " Total available space: {0, 15} bytes", d.TotalFreeSpace); Console.WriteLine( " Total size of drive: {0, 15} bytes ", d.TotalSize); } }
Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com
-
hi all, I am working on a Windows Services where i need to find the disk space of C: drive.Is it possible? Can u plz give some suggestions.. Thanks in advance,
cheers sangeet
But at the server side only using this code System.IO.DriveInfo drive = new System.IO.DriveInfo("C"); play with drive object i hope it will help you
Thanks and Regards Sandeep
-
hi all, I am working on a Windows Services where i need to find the disk space of C: drive.Is it possible? Can u plz give some suggestions.. Thanks in advance,
cheers sangeet
hey thanks for ur help..i got it.. but the totalspace,totalfree space are in bytes..how do i convert it to MB or GBs. Thanks again for ur help..
cheers sangeet
-
hey thanks for ur help..i got it.. but the totalspace,totalfree space are in bytes..how do i convert it to MB or GBs. Thanks again for ur help..
cheers sangeet
Apply logic 1024 bytes =1 Mb \ do calculations
Thanks and Regards Sandeep
-
Apply logic 1024 bytes =1 Mb \ do calculations
Thanks and Regards Sandeep
yes i got it..thanks a lot..
cheers sangeet