bl4kh4k
bl4kh4k

Reputation: 1440

DriveInfo.TotalSize does not indicate correct value

DriveInfo.TotalSize does not indicate the correct value, or possibly does but in my case its invalid to use.

I need to find the total size of the drive however if the drive is completely empty... why is it that when spitting out a messagebox with the AvailableFreeSpace and the TotalSize results in two different values?

if (drive.AvailableFreeSpace != drive.TotalSize) { /* copy data to another drive. */ }

Upvotes: 2

Views: 747

Answers (1)

Irvin Dominin
Irvin Dominin

Reputation: 30993

In the MSDN there is a note about AvialableFreeSpace property, it tells:

This property indicates the amount of free space available on the drive. Note that this number may be different from the TotalFreeSpace number because this property takes into account disk quotas.

Reference: http://msdn.microsoft.com/en-us/library/system.io.driveinfo.availablefreespace.aspx

Upvotes: 1

Related Questions