VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 目录所占的字节数
发表评论(0)作者:, 平台:, 阅读:13164, 日期:2000-03-12
目录所占的字节数

该函数返回目录使用的字节数:


Function DirUsedBytes(ByVal dirName As String) As Long

Dim FileName As String

Dim FileSize As Currency

If Right$(dirName, 1) <> "\" Then

dirName = dirName & "\"

Endif

FileSize = 0

FileName = Dir$(dirName & "*.*")

Do While FileName <> ""

FileSize = FileSize + _

FileLen(dirName & FileName)

FileName = Dir$

Loop

DirUsedBytes = FileSize

使用:

MsgBox DirUsedBytes("C:\Windows")