Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Find file size directory tree
Option #2: There is an example script called "file size finder.wbt" in
the WinBatch\Sample directory. Here is a copy of the script.
DIRSIZE: This file traverses the directory tree and computes the total
size of all files on the drive.
DirChange("C:\") BoxOpen("File Size Inspector","Reading Initial Directories") tot = FileSize(FileItemize("*.*")) sub1 = DirItemize("*.*") totdir=0 level=1 dir1=DirGet() numdir1 = ItemCount(sub1, @tab) index1 = 0 :dsloop If index%level% == numdir%level% Then Goto upalevel index%level% = index%level% + 1 DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, @tab))) BoxText(strcat("Level=",level,@crlf,"Total=",tot,@crlf,dir%level%)) totdir=totdir+1 tot = tot + FileSize(FileItemize("*.*")) level = level + 1 dir%level% = DirGet() sub%level% = DirItemize("*.*") numdir%level% = ItemCount(sub%level%, @tab) index%level% = 0 goto dsloop :upalevel drop(dir%level%,sub%level%,index%level%,numdir%level%) level=level-1 if level!=0 then goto dsloop ; ----------- ; Termination ; ----------- BoxShut() If StrLen(tot) < 9 Then tot = StrCat(StrFill("", 9 - StrLen(tot)), tot) tot = StrCat(StrSub(tot,1,3),",",StrSub(tot,4,3),",",StrSub(tot,7,3)) tot = StrTrim(tot) If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1) tot = StrTrim(tot) If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1) tot = StrTrim(tot) Message("%totdir% Subdirectories included", "Total size %tot% bytes.") Exit
Article ID: W13227
Filename: Compute File Sizes.txt
File Created: 2001:01:03:10:12:12
Last Updated: 2001:01:03:10:12:12