منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : حجم مجلد
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
مساء الخير

هل يوجد كود للتعرف على حجم مجلد بجميع محتوياته 

وشكرا
أهلا أخي الكريم , إستخدم هذا الكود :

PHP كود :
Private Function SetBytes(Bytes) As String
On Error 
GoTo zErr

If Bytes >= 1073741824 Then
    SetBytes 
Format(Bytes 1024 1024 1024"#0.00"_
         
" GB"
ElseIf Bytes >= 1048576 Then
    SetBytes 
Format(Bytes 1024 1024"#0.00") & " MB"
ElseIf Bytes >= 1024 Then
    SetBytes 
Format(Bytes 1024"#0.00") & " KB"
ElseIf Bytes 1024 Then
    SetBytes 
Fix(Bytes) & " Bytes"
End If

Exit Function
zErr:
SetBytes "0 Bytes"
End Function

Private 
Sub Command1_Click()

Dim FSO As Object
Dim Folder 
As Object

Set FSO 
CreateObject("Scripting.FileSystemObject")

If 
FSO.FolderExists("C:\Program Files"Then
   Set Folder 
FSO.GetFolder("C:\Program Files")
   
MsgBox SetBytes(Folder.Size)
End If

Set Folder Nothing
Set FSO 
Nothing

End Sub