checking free disk space w/ .NET....

  • Thread starter Thread starter awm129
  • Start date Start date
A

awm129

.... how do I do it? I'm writing a webapp that allows uploading but I
want to check the free diskspace on the server before I allow the
upload. I know how to do this w/ WIN32 and I could just pinvoke the
proper DLL but there must be a way to do it in .NET?

If it matters, I'm using C#.
 
... how do I do it? I'm writing a webapp that allows uploading but I
want to check the free diskspace on the server before I allow the
upload. I know how to do this w/ WIN32 and I could just pinvoke the
proper DLL but there must be a way to do it in .NET?

If it matters, I'm using C#.


http://zamov.online.fr/EXHTML/CSharp/CSharp_163422.html

"using System;
using System.Management;

....

ManagementObject disk = new
ManagementObject("win32_logicaldisk.deviceid="c:"");
disk.Get();
Console.WriteLine("Logical Disk Size = " + disk["Size"] + " bytes");
Console.WriteLine("Logical Disk FreeSpace = " + disk["FreeSpace"] + "
bytes"); "
 
John said:
http://zamov.online.fr/EXHTML/CSharp/CSharp_163422.html

"using System;
using System.Management;

...

ManagementObject disk = new


Thanks John! Thats exactly what I was looking for! Worked like a
charm...
ManagementObject("win32_logicaldisk.deviceid="c:"");
disk.Get();
Console.WriteLine("Logical Disk Size = " + disk["Size"] + " bytes");
Console.WriteLine("Logical Disk FreeSpace = " + disk["FreeSpace"] + "
bytes"); "
 
Back
Top