Xojo Conferences
MBSOct2019CologneDE

Determining number of files in a given folder/disk. (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Control the appearance of EditFields in ListBoxes
Next thread: [OFF] help with Adobe GoLive 6


"I feel the need for speed" (string)   -   Jan Erik Moström <
  Determining number of files in a given folder/disk.   -   Lists
   Re: Determining number of files in a given folder/disk.   -   Joseph J. Strout
   Re: Determining number of files in a given folder/disk.   -   Steve W. Jackson
    Re: Determining number of files in a given folder/disk.   -   Norman Palardy
     Re: Determining number of files in a given folder/disk.   -   Lists

Determining number of files in a given folder/disk.
Date: 08.05.02 03:31 (Tue, 07 May 2002 21:31:41 -0500)
From: Lists
Hi all!

Does the Mac OS provide any sort of API for determining the number of
files/subfolders within any given folderItem? I need to be able to quickly
determine how many subfolders/files are contained in any given folder,
including those files in subfolders.

Any ideas?

Thanks!

Scott

Re: Determining number of files in a given folder/disk.
Date: 08.05.02 15:33 (Wed, 8 May 2002 07:33:13 -0700)
From: Joseph J. Strout
At 9:31 PM -0500 5/7/02, Scott Crick (Lists) wrote:

>Does the Mac OS provide any sort of API for determining the number of
>files/subfolders within any given folderItem? I need to be able to quickly
>determine how many subfolders/files are contained in any given folder,
>including those files in subfolders.

I don't think so. You have to recurse and do the sum yourself.

Cheers,
- Joe

P.S. Apologies if I seem to be replying late -- I can only grab my
mail now and then, then I queue up replies at other times, and send
'em off the next time I get a chance.

Re: Determining number of files in a given folder/disk.
Date: 08.05.02 14:08 (Wed, 8 May 2002 08:08:22 -0500)
From: Steve W. Jackson
>Subject: Determining number of files in a given folder/disk.
>From: "Scott Crick (Lists)" <<email address removed>>
>Date: Tue, 07 May 2002 21:31:41 -0500
>
>Hi all!
>
>Does the Mac OS provide any sort of API for determining the number of
>files/subfolders within any given folderItem? I need to be able to quickly
>determine how many subfolders/files are contained in any given folder,
>including those files in subfolders.
>
>Any ideas?
>
>Thanks!
>
>Scott

Scott,

I don't think the OS has any built-in method, but it's not hard to do
with RB. In fact, how it's done has been discussed here many times
in terms of things like iterating through all items for delete, copy,
etc. The easiest way, IMHO, is to recurse from a starting point and
simply count items there, descending into each folder and repeating,
etc. But, as has properly been pointed out here, that could lead to
a stack overflow condition if it's deep enough -- so it can be done
with looping only. Searching the archives should turn up something.
I have archives back quite some time myself, so if it gets bad I can
try and find it for you.

= Steve --
Steve W. Jackson
Montgomery, Alabama

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Determining number of files in a given folder/disk.
Date: 08.05.02 16:12 (Wed, 8 May 2002 09:12:42 -0600)
From: Norman Palardy
Or I can send you some code that will walk the directory in a loop
instead of recursively

On Wednesday, May 8, 2002, at 07:08 AM, Steve W. Jackson wrote:

>> Subject: Determining number of files in a given folder/disk.
>> From: "Scott Crick (Lists)" <<email address removed>>
>> Date: Tue, 07 May 2002 21:31:41 -0500
>>
>> Hi all!
>>
>> Does the Mac OS provide any sort of API for determining the number of
>> files/subfolders within any given folderItem? I need to be able to
>> quickly
>> determine how many subfolders/files are contained in any given folder,
>> including those files in subfolders.
>>
>> Any ideas?
>>
>> Thanks!
>>
>> Scott
>
> Scott,
>
> I don't think the OS has any built-in method, but it's not hard to do
> with RB. In fact, how it's done has been discussed here many times in
> terms of things like iterating through all items for delete, copy,
> etc. The easiest way, IMHO, is to recurse from a starting point and
> simply count items there, descending into each folder and repeating,
> etc. But, as has properly been pointed out here, that could lead to a
> stack overflow condition if it's deep enough -- so it can be done with
> looping only. Searching the archives should turn up something. I have
> archives back quite some time myself, so if it gets bad I can try and
> find it for you.
>
> = Steve > -- Steve W. Jackson
> Montgomery, Alabama
>
> ---
> Subscribe to the digest: <mailto:realbasic-nug-
> <email address removed>>
> Unsubscribe:
> <mailto:<email address removed>>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Determining number of files in a given folder/disk.
Date: 09.05.02 00:51 (Wed, 08 May 2002 18:51:58 -0500)
From: Lists
On 5/8/02 10:12 AM, "Norman Palardy" <<email address removed>> wrote:

> Or I can send you some code that will walk the directory in a loop
> instead of recursively

Thanks all for the replies. I have code which does this already, I was just
wondering if there was a faster way to do this. Depending on where you
start, this can take a LONG time!

But, thanks again anyway!

Scott