-
August 15th, 2009, 10:20 AM
#1
Free disk space and attributes...
Hello, can you help me with free disk space and folder attributes ? how can i get the size in GB and how can i find the attributes (write,read) on a share ? thanks...
* i know how to find free disk space in bytes.
* it's same in linux partitions and windows? (size and attributes code)
thanks
Last edited by invader7; August 15th, 2009 at 10:23 AM.
-
August 16th, 2009, 04:33 AM
#2
Re: Free disk space and attributes...
you only need some math calculation to get free space in GB:
Code:
private void button1_Click(object sender, EventArgs e)
{
ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid='e:'");
disk.Get();
double diskSize = (ulong)disk["Size"] / (Math.Pow(1024, 3));
double diskFree = (ulong)disk["FreeSpace"] / (Math.Pow(1024, 3));
double percentFree = (diskFree * 100) / diskSize;
label1.Text = String.Format("Your Total Disk Size on Drive E is: {0:#.##} Giga Bytes", diskSize);
label2.Text = String.Format("Your Free Disk Space on Drive E is: {0:#.##} %", percentFree);
}
Please rate my post if it was helpful for you. Java, C#, C++, PHP, ASP.NET
SQL Server, MySQL
DirectX
MATH Touraj Ebrahimi
[toraj_e] [at] [yahoo] [dot] [com]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|