什么是计算在Windows文件夹大小的最快方法是什么? [英] What is the fastest way to calculate a Windows folders size?

查看:294
本文介绍了什么是计算在Windows文件夹大小的最快方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要计算数百个文件夹的大小,有些会10MB一些也许10GB,我需要得到每个文件夹的大小,使用C#的超快速的方式。

I need to calculate the size of hundreds of folders, some will be 10MB some maybe 10GB, I need a super fast way of getting the size of each folder using C#.

我的最终结果将有望为:

My end result will hopefully be:

Folder1中10.5GB

Folder1 10.5GB

FOLDER2 230MB

Folder2 230MB

Folder3 1.2GB

Folder3 1.2GB

...

推荐答案

有没有简单的方法来做到这一点。NET中;您将通过每个文件和子目录必须循环。 见例子这里,看看它是如何做。

There is no simple way to do this in .Net; you will have to loop through every file and subdir. See the examples here to see how it's done.

这篇关于什么是计算在Windows文件夹大小的最快方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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