DriveInfo: Total vs. Available Free Space

If you’re curious about how query a drive and find out how much free space is left on it, in C#, there’s a conveniant DriveInfo class which exposes two properties for your usage: TotalFreeSpace and AvailableFreeSpace.

What’s the difference?

AvailableFreeSpace returns the amount of free space available given disk quotas. Yes, it’s true; apparently, every Windows OS since Windows 2000 implements and allows you to specify storage quotas.

TotalFreeSpace, on the other hand, just gives you the total amount of free space on the disk — just bear in mind that you may not be able to use all of it (depending on your user and permissions/quotas).

About Ashiq Alibhai, PMP

Ashiq has been coding C# since 2005. A desktop, web, and RIA application developer, he's touched ASP.NET MVC, ActiveRecord, Silverlight, NUnit, and all kinds of exciting .NET technologies. He started C# City in order to accelerate his .NET learning.
This entry was posted in Core .NET, Wndows Forms and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *