Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27156

Size and Size on disk problems.

$
0
0
Hi guys,

I need a bit of help on finding out how to calculate file/folder sizes :)

Code:

Dim fileSize As Long = 0
        'Dim drInfo As New DirectoryInfo("C:\some\random\folder")


        Dim filesInfo() As FileInfo = drInfo.GetFiles("*.*", SearchOption.AllDirectories)

        For Each fileInfo As FileInfo In filesInfo
            fileSize += fileInfo.Length
        Next

So thats my current code. It perfectly calculates the "size" of the folder. However, what i'm really after, is the "size on disk" property, as it appears under the folder's properties.

You can see the massive difference in the picture below.

Name:  cropn.png
Views: 51
Size:  4.2 KB

Any help in finding the size on disk would be great :)

Thanks!
Attached Images
 

Viewing all articles
Browse latest Browse all 27156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>