Yes, it totalizes every file that encounters traversing all subdirs. May be
an "H" must be added to the "D" for hidden files, I didn't tested with them
totally.

The OS haven't a command for this, that's why when you
right-click/properties a folder, you can see that in this moment the disk
reads a lot, because it's doing the same.

2016-08-03 18:33 GMT+02:00 Stephen Russell <srussell...@gmail.com>:

> Does this walk the folder tree and pull the sizes from en-US, etc, SEP, and
> on and on... totaling all of the sizes combined?
>
> I am guessing that there is no api that does this in Win7 at least.  From
> the explorer I click for Properties of a BIG folder and it takes a few secs
> to total up all the content.  You see it flashing as it updates.
>
> Case in point C:\Windows  46.1 gig for me.  YMMV
>
>
>
> On Wed, Aug 3, 2016 at 8:21 AM, Fernando D. Bozzo <fdbo...@gmail.com>
> wrote:
>
> > Another solution pure VFP here:
> >
> > ? get_DirSize("c:\Windows\System32\drivers")
> >
> >
> > PROCEDURE get_DirSize
> >     LPARAMETERS tcDir
> >     EXTERNAL ARRAY taFiles
> >     LOCAL laFiles(1), I, lnFiles
> >
> >     IF VARTYPE(pnDirSize) <> "N"
> >         PRIVATE pnDirSize
> >         pnDirSize = 0
> >     ENDIF
> >
> >     tcDir    = ADDBS(tcDir)
> >     lnFiles = ADIR( laFiles, tcDir + '*.*', 'D', 1)
> >
> >     FOR I = 1 TO lnFiles    && Look for files
> >         IF NOT SUBSTR( laFiles(I,5), 5, 1 ) == 'D'
> >             pnDirSize    = pnDirSize + laFiles(I,2)
> >         ENDIF
> >     ENDFOR
> >
> >     FOR I = 1 TO lnFiles    && Look for Subdirs
> >         IF SUBSTR( laFiles(I,5), 5, 1 ) == 'D' AND NOT
> INLIST(laFiles(I,1),
> > '.', '..')
> >             get_DirSize( tcDir + laFiles(I,1) )
> >         ENDIF
> >     ENDFOR
> >
> >     RETURN pnDirSize
> > ENDPROC
> >
> >
> > 2016-08-03 13:43 GMT+02:00 Laurie Alvey <trukke...@gmail.com>:
> >
> > > 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 <srussell...@gmail.com>
> > 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 <
> fdbo...@gmail.com>
> > > > 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" <g-loc...@wanadoo.fr> 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: ProFox@leafe.com
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/CAGQ_Ju=vkM+HY0qzMN3xbvAmZ=ypf9ta3xivhbyzw50p-tw...@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.

Reply via email to