Author: Joe Yoder
Posted: 2016-07-30 06:04:50 Link
Is there a programatic shortcut to finding the size of an entire
folder/subfolder structure without recursing through it in VFP?
Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
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/CABQeDnWLRb2GD6czCCMBb4X9VtYFo+W_XbAxSuMiGZAFh1G-_w@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.
Author: Gérard LOCHON
Posted: 2016-07-30 08:12:43 Link
There isn't such a thing in the Win API.
You have to it by yourself, even if it is in C.
Gérard.
Le 30/07/2016 à 13:04, Joe Yoder a écrit :
> Is there a programatic shortcut to finding the size of an entire
> folder/subfolder structure without recursing through it in VFP?
>
> Thanks in advance,
>
> Joe
>
_______________________________________________
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/97cc9ad7-315a-3b84-85ae-efa450d4634a@wanadoo.fr
** 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.
Author: Joe Yoder
Posted: 2016-07-30 08:43:19 Link
Thanks - I suspected that.
On Sat, Jul 30, 2016 at 9:12 AM, Gérard LOCHON <g-lochon@wanadoo.fr> wrote:
> There isn't such a thing in the Win API.
>
> You have to it by yourself, even if it is in C.
>
>
> Gérard.
>
>
>
> Le 30/07/2016 à 13:04, Joe Yoder a écrit :
>
>> Is there a programatic shortcut to finding the size of an entire
>> folder/subfolder structure without recursing through it in VFP?
>>
>> Thanks in advance,
>>
>> Joe
>>
>>
>
[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/CABQeDnXLMzJeixCYfgZotd+ffYw-q01nxryOTyoVQBYN4wF3gw@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.
Author: Allen Pollard
Posted: 2016-07-30 09:04:35 Link
Not sure if this helps using the scripting runtime
fso = createobject("Scripting.FileSystemObject")
folder = fso.GetFolder(GetDir())
? folder.Size
Al
-----Original Message-----
From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder
Sent: 30 July 2016 15:43
To: profoxtech@leafe.com
Subject: Re: API to find the size of an entire folder structure?
Thanks - I suspected that.
_______________________________________________
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/002e01d1ea6b$4e284fc0$ea78ef40$@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.
Author: Jean MAURICE
Posted: 2016-07-30 09:19:34 Link
Why not create a recursive function with ADIR() ?
The Foxil
_______________________________________________
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/579CB776.1030702@wanadoo.fr
** 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.
Author: Joe Yoder
Posted: 2016-07-30 13:46:07 Link
I was planning to go the recursive ADIR route but am intrigued by the WSH
approach. I had read about it in the past but always assumed it was only
available on machines that have been configured to run it. A quick check
of the environments I work in now shows they all have it.
I ran the sample code and discovered if I select a folder too high on the
root I get an "OLE error code 0x800a00046: Unknown COM status code."
error. Other than that I think I will find the functions quite useful.
Thanks again - Joe
On Sat, Jul 30, 2016 at 10:19 AM, Jean MAURICE <jsm.maurice@wanadoo.fr>
wrote:
> Why not create a recursive function with ADIR() ?
>
> The Foxil
>
>
[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/CABQeDnUu0qcZZNS7HT0-un_ELfS8hK67m4-ptVL_W4ccSnVkZQ@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.
Author: Edward Leafe
Posted: 2016-07-31 00:29:41 Link
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
---
_______________________________________________
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/1365E4ED-33A8-4A1D-81DE-0C474FCD8B8D@leafe.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.
Author: Laurie Alvey
Posted: 2016-07-31 05:22:16 Link
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]
_______________________________________________
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/CAMvTR9fQCf6d6dd3N7h56A4Sdd-mHG=Bv1Hv+pfXR-1Jh0VMyA@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.
Author: Dave Crozier
Posted: 2016-08-01 03:53:28 Link
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]
_______________________________________________
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/18725B8CD2D5D247873A2BAF401D4AB29022C72B@EX2010-A-FPL.FPL.LOCAL
** 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.
Author: Gérard LOCHON
Posted: 2016-08-01 05:48:26 Link
This solution must be corrected, because the path length may exceed the
field size limit while recursing thru the directories.
Personnaly, i create another cursor to contains the pathnames :
Pathes(pkid i, path m)
When you start a new subdirectory, you insert it in Pathes cursor, and
in each row of Files cursor you put the Pathes.pkid instead of the path.
A simple request can join the pertinent data.
So far so good, it runs faster and takes less working storage.
Gérard.
Le 01/08/2016 à 10:53, Dave Crozier a écrit :
> 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]
_______________________________________________
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/91fb345e-a67f-3b0c-e53e-5d2f08ae3c5a@wanadoo.fr
** 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.