You can also use filer.dll like this:
LOCAL oFiler As CFileUtil OF Filer.FileUtil
LOCAL i, n, c, o
CREATE CURSOR files (fullname V(50), attrib I, bytes I)
oFiler = NEWOBJECT("Filer.FileUtil")
oFiler.SearchPath = GETDIR()
IF EMPTY(oFiler.SearchPath)
RETURN
ENDIF
oFiler.SubFolder = 1
oFiler.FileExpression = "*.*"
oFiler.Find(0)
n = oFiler.Files.Count
IF n > 0
CLEAR
FOR i = 1 TO n
o = oFiler.Files.Item(i)
c = o.Path + o.Name
INSERT INTO files VALUES (c, o.Attr, o.Size)
ENDFOR
ENDIF
SUM bytes TO n
? "Total size", CAST(n As B(0))
Laurie
On 2 August 2016 at 12:46, Stephen Russell <[email protected]> wrote:
> Have used this in C# a long time ago.
>
> long length =
> Directory.GetFiles(directoryPath,"*",SearchOption.AllDirectories).Sum(t
> => (new FileInfo(t).Length));
>
>
> On Tue, Aug 2, 2016 at 12:58 AM, Fernando D. Bozzo <[email protected]>
> wrote:
>
> > Yeah, I know, but I tend to find optimization and speed.
> > It's the same as using "select * into cursor" just for looking the _tally
> >
> > El 2/8/2016 7:40, "Gérard LOCHON" <[email protected]> escribió:
> >
> > > Generally, it's multipurpose
> > >
> > >
> > > Le 02/08/2016 à 00:56, Fernando D. Bozzo a écrit :
> > >
> > >> I think that creating a cursor and is too much for something that only
> > >> need
> > >> to sum file lenghts.
> > >> Can be done with 2 arrays, one needed for ADIR and one for keeping the
> > >> paths and subtotals.
> > >>
> > >>
> > >
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/CAMvTR9fjWvf==v6D1mnB=_udzjogpeildm7wy7bgxajrpox...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.