Anil Namde
Anil Namde

Reputation: 6608

How to check logical and physical file size on disk using C# file API

How to read the logical and physical file size using C# api.

enter image description here

Upvotes: 5

Views: 7685

Answers (1)

Gal
Gal

Reputation: 5416

(new FileInfo(path).Length)

is the actual size. As for size on disk, I don't think there's an API to get it, but you can get it using the actual size, and the cluster size.

There's some info on the calculation required here: http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/85bf76ac-a254-41d4-a3d7-e7803c8d9bc3

Upvotes: 2

Related Questions