简体   繁体   English

如何使用C#文件API检查磁盘上的逻辑和物理文件大小

[英]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. 如何使用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. 至于磁盘上的大小,我认为没有一个API可以获得它,但你可以使用实际大小和群集大小来获取它。

There's some info on the calculation required here: http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/85bf76ac-a254-41d4-a3d7-e7803c8d9bc3 这里需要计算一些信息: http//social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/85bf76ac-a254-41d4-a3d7-e7803c8d9bc3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 c# 形式的 savefileDialog 检查我已经在磁盘中创建的文件? - How can I check the file I created already in the disk using savefileDialog in c# form? 如何使用C#在硬盘中保存文本文件 - How to save a text file in Hard Disk using C# 如何使用C#检查电子邮件中的文件? - How to check email for file using c#? 如何检查我的 C# 程序中的文件大小? - How to check the file size inside my C# program? 如何遍历物理文件夹并读取C#中的叶文件 - How to iterate through the physical folders and read a leaf file in C# 如何从SQL Server获取图像数据,写入文件,使用C#将文件保存到磁盘 - How to get Image data from SQL Server, Write To File, Save File to Disk using C# 如何从C#获取虚拟驱动器中文件的物理路径 - How to get the physical path of a file that is in a virtual drive from C# 如何将 GIF 文件转换为视频文件并在 C# 中将其保存到磁盘? - How to convert a GIF file to a video file and save it to disk in c#? 在 C# 中检查硬盘是否为 SSD 而不在硬盘上写入任何文件的最简单方法是什么? - What is the easiest way in C# to check if hard disk is SSD without writing any file on hard disk? ms 图形 API - 如何在 C# 中使用图形客户端检出文件 - ms graph API - how to check out a file using the graph client in c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM