[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting folder size
[Thread Prev] | [Thread Next]
- Subject: Re: getting folder size
- From: Brian G <brian@xxxxxxxxxxxxxxxx>
- Date: Tue, 19 Mar 2024 15:01:37 -0700
- To: user@xxxxxxxxxxxxxxxxxxxxxx
BruceUpdate, Attached is an updated version of your app, it seems arch's version of du does not include the size of the directories??
and that arm uses a different stat version. Attached is the updated version supporting those environments as well. On 3/12/24 12:17, Bruce Steers wrote:
I made a function to get a folder size but it differs to du command.I've tried many different things and have no clue as to why i am only getting partly matched results.I'm missing something along the line. My routine is simply this... Public Sub DirSize(Folder As String) As Long Inc iCount Dim iSize As Long With Stat(Folder) iSize += .Size If .Type = gb.Link Then Return ' do not compute if a link End With For Each sItem As String In Dir(Folder) With Stat(Folder &/ sItem) If .Type = gb.Directory Then iSize += DirSize(Folder &/ sItem) Else iSize += .Size Endif End With Next Print iCount, iSize; "\r"; Return iSize End checking most folders gives a match to "du -sb" command but some do not. /home/bonus/.local/share 130117 4959360696 4959360696 (mine) 4327428432 : out by 631932264 (du -sb) /home/bonus/.config 498 1367011275 1367011275 (mine) 1367011275 : MATCH (du -sb) Like i say "most" folders are giving a match but some do not. Is my code at fault? is the du command wrong? Does anyone have some well written directory size calculator code? Attached is a test prog with the function Respects and thanks in advance BruceS
-- ~~~~ Brian
Attachment:
dirsize1-0.1.tar.gz
Description: application/gzip
Attachment:
OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature
getting folder size | Bruce Steers <bsteers4@xxxxxxxxx> |