Try this 100% VFP solution. It puts the recursive contents of a folder into a cursor with file size and you can then sum the size.
***************** * START OF CODE ***************** * Display Files in a Folder within a Table * Written by: Dave Crozier * Amendments: * 04/09/2015 - Add in field to contain file size for Paul Newton * Clear All
Clear
Public oForm
oForm=Createobject("MyForm",Addbs(Getdir("c:\temp")),"*.*",.F.)
Define Class MyForm As Form AllowOutput=.F. && so '?' output goes to screen Width=_Screen.Width Height=_Screen.Height-50 Width=1024 Height=798
Procedure Init(cPath As String, cMask As String, fSubDir As Boolean) Set Exclusive Off Set Safety Off Set Talk Off Set Exact Off Create Cursor Files (Path c(240),fname c(240),Fsize N(10,0),Timestamp T)
This.DoDir(cPath,cMask)
Index On Timestamp Descending Tag T && choose your desired order
* INDEX on fsize DESCENDING TAG fsize
With This .AddObject("gr","grid") With .gr .AllowCellSelection=.F. .Visible=1 .Height=Thisform.Height .Width = Thisform.Width .AutoFit .Column3.InputMask="999,999,999" Endwith .Show * Endwith Procedure DoDir(cPath As String, cMask As String)
Local N,i,aa[1]
N=Adir(aa,cPath+cMask,"",1)
For i = 1 To N
Insert Into Files (Path,fname,Fsize,Timestamp) Values ; (cPath, aa[i,1], aa[i,2], Ctot(Dtoc(aa[i,3])+aa[i,4]))
Endfor
N=Adir(aa,cPath+"*.*","HD",1) && now without the mask, search for directories
For i = 1 To N
If "D"$aa[i,5] && if it's a dir
If aa[i,1] != '.'
This.DoDir(cPath+aa[i,1]+"",cMask) && recur
Endif
Endif
Endfor
Enddefine * **************** * End of Code ****************
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 31 July 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: API to find the size of an entire folder structure?
Another useful tool is vfp2c32.fll from VFPx. It has lots of file/folder functions e.g. ADirInfo().
Laurie
On 31 July 2016 at 06:29, Edward Leafe ed@leafe.com wrote:
On Jul 30, 2016, at 8:43 AM, Joe Yoder joe@wheypower.com wrote:
Thanks - I suspected that.
This is one area where I suspect Linux has an advantage. Looks at all the different ways to approach it: http://www.codecoffee.com/tipsforlinux/articles/22.html
-- Ed Leafe
--- StripMime Report -- processed MIME parts --- multipart/signed text/plain (text body -- kept) application/pgp-signature
[excessive quoting removed by server]