返回指定目錄的大小(字節(jié)).
DirGetSize ( "路徑" [, 標(biāo)志] )
路徑 | 目標(biāo)目錄的路徑, 例如 "C:\Windows". |
標(biāo)志 | [可選參數(shù)] 確定函數(shù)的操作及結(jié)果, 可以是下列值的組合: 0 = (默認(rèn)) 1 = 啟用擴(kuò)展模式, 返回包含擴(kuò)展信息的數(shù)組(見備注). 2 = 不計(jì)算子目錄的文件大小(關(guān)閉遞歸模式) |
成功: | 返回大于(等于) 0 的大小值 |
失敗: | 返回 -1. 設(shè)置 @error 為 1, 路徑不存在. |
Local $size
= DirGetSize(@HomeDrive)
MsgBox(0, "", "大小(MB):" & Round($size / 1024 / 1024))
$size =
DirGetSize(@WindowsDir, 2)
MsgBox(0, "", "大小(MB):" & Round($size / 1024 / 1024))
Local $timer
= TimerInit()
$size =
DirGetSize("F:\3.3.7.15", 1);請(qǐng)?jiān)囋囂钊胍粋€(gè)真實(shí)路徑
Local $diff
= Round(TimerDiff($timer) / 1000) ;
按秒計(jì)時(shí)
If IsArray($size) Then
MsgBox(0, "DirGetSize-信息", "大小(字節(jié)):" & $size[0] & @LF _
& "文件數(shù):" & $size[1] & @LF & "目錄數(shù):" & $size[2]
& @LF
_
& "用時(shí)(秒):" & $diff)
EndIf
provider with jb51.net (unicode) |