如何使用C#文件API来检查磁盘上的逻辑和物理文件大小 [英] How to check logical and physical file size on disk using C# file API

查看:154
本文介绍了如何使用C#文件API来检查磁盘上的逻辑和物理文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何阅读使用C#API的逻辑和物理文件的大小。




解决方案

 (新的FileInfo(路径)。长度)

是实际大小。
至于在磁盘上,我不认为有一个API来得到它,但你可以使用的实际大小,簇的大小得到它的大小。



有一个在计算存在一定的信息在这里需要:
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/85bf76ac-a254-41d4-a3d7-e7803c8d9bc3


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

解决方案

(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

这篇关于如何使用C#文件API来检查磁盘上的逻辑和物理文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆