Xojo Conferences
MBSOct2019CologneDE

Examine Folder (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Making apps recordable - aedt resource?
Next thread: Please add alias record functionality to RB


FFT on an audio track   -   Wright, Tim
  Examine Folder   -   Ian Devaney
   Re: Examine Folder   -   Frank Bitterlich
   Re: Examine Folder   -   Norman Palardy
    RE: Examine Folder   -   DavidM ceilearning.com
   Re: Examine Folder   -   Ian Devaney
    Re: Examine Folder   -   George Clark

Examine Folder
Date: 28.08.02 13:10 (Wed, 28 Aug 2002 13:10:43 +0100)
From: Ian Devaney

My app needs to examine a folder to get its size and number of items
(including all sub-folders). Since this is exactly what the Finder does when
you use "Get Info" on a folder, I was wondering if there is any declare,
plug-in or class that allows you to do this in the same way as the Finder
and just as fast!

Cheers,

Ian.

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

Re: Examine Folder
Date: 28.08.02 13:39 (Wed, 28 Aug 2002 14:39:50 +0200)
From: Frank Bitterlich
Script the Finder; otherwise it's a lot of work. Even the Finder
sometimes needs ages to calculate the size.

Cheers,
Frank+++

Ian Devaney wrote:
>
> My app needs to examine a folder to get its size and number of items
> (including all sub-folders). Since this is exactly what the Finder does when
> you use "Get Info" on a folder, I was wondering if there is any declare,
> plug-in or class that allows you to do this in the same way as the Finder
> and just as fast!

Re: Examine Folder
Date: 28.08.02 16:01 (Wed, 28 Aug 2002 09:01:09 -0600)
From: Norman Palardy
I'd put money on it using one of the following (these are from Files.h
in the MAC OS Universal headers)

/*
GetCatalogInfoBulk
Iterates over catalog objects and returns information about them.
For now, iterator must have been created with kFSIterateFlat option.
-> ioCompletion A pointer to a completion routine
<- ioResult The result code of the function
-> iterator The iterator
-> maximumItems The maximum number of items to return
<- actualItems The actual number of items returned
<- containerChanged Set to true if the container's contents changed
-> whichInfo The catalog information fields to return for
each item
<- catalogInfo An array of catalog information; one for each
returned item
<- refs An array of FSRefs; one for each returned item
<- specs An array of FSSpecs; one for each returned item
<- names An array of filenames; one for each returned
item
Note: The catalogInfo, refs, specs, names, and containerChanged are
all optional outputs;
if you don't want that particular output, set its pointer to NULL.
*/
/*
* FSGetCatalogInfoBulk()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 9.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 or later
*/
EXTERN_API( OSErr )
FSGetCatalogInfoBulk(
FSIterator iterator,
ItemCount maximumObjects,
ItemCount * actualObjects,
Boolean * containerChanged, /* can be NULL */
FSCatalogInfoBitmap whichInfo,
FSCatalogInfo * catalogInfos, /* can be NULL */
FSRef * refs, /* can be NULL */
FSSpec * specs, /* can be NULL */
HFSUniStr255 * names) /* can be NULL */
THREEWORDINLINE(0x303C, 0x1226, 0xAA52);

/*
* PBGetCatalogInfoBulkSync()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 9.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 or later
*/
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
#pragma parameter __D0 PBGetCatalogInfoBulkSync(__A0)
#endif
EXTERN_API( OSErr )
PBGetCatalogInfoBulkSync(FSCatalogBulkParam * paramBlock)
TWOWORDINLINE(0x705C, 0xA260);

/*
* PBGetCatalogInfoBulkAsync()
*
* Availability:
* Non-Carbon CFM: in InterfaceLib 9.0 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 or later
*/
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
#pragma parameter PBGetCatalogInfoBulkAsync(__A0)
#endif
EXTERN_API( void )
PBGetCatalogInfoBulkAsync(FSCatalogBulkParam * paramBlock)
TWOWORDINLINE(0x705C, 0xA660);

On Wednesday, August 28, 2002, at 06:10 AM, Ian Devaney wrote:

>
> My app needs to examine a folder to get its size and number of items
> (including all sub-folders). Since this is exactly what the Finder
> does when
> you use "Get Info" on a folder, I was wondering if there is any
> declare,
> plug-in or class that allows you to do this in the same way as the
> Finder
> and just as fast!
>
> Cheers,
>
> Ian.
>
> ---
> Subscribe to the digest:
> <mailto:<email address removed>>
> Unsubscribe:
> <mailto:<email address removed>>

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

RE: Examine Folder
Date: 28.08.02 14:29 (Wed, 28 Aug 2002 08:29:24 -0500)
From: DavidM ceilearning.com
Ian,

There is an example in the RB Language Ref that shows how to recursively
copy a folder full of file. If you adapted that function to increment a
folder/file and size counters you will have the routine you're looking for.

David Merryweather
Chief Information Officer
Creative Education Institute
254.751.1188

> -----Original Message-----
> From: Ian Devaney [mailto:<email address removed>]
> Sent: Wednesday, August 28, 2002 7:11 AM
> To: RB Digest
> Subject: Examine Folder
>
> My app needs to examine a folder to get its size and number
> of items (including all sub-folders). Since this is exactly
> what the Finder does when you use "Get Info" on a folder, I
> was wondering if there is any declare, plug-in or class that
> allows you to do this in the same way as the Finder and just as fast!

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

Re: Examine Folder
Date: 28.08.02 17:41 (Wed, 28 Aug 2002 17:41:54 +0100)
From: Ian Devaney

Thanks for all the suggestions on this one.

It seems like an AppleScript should do the trick - but this means I'm stuck
again!

I've only ever used very simple AppleScripts (usually written by other
people!) so I really don't know where to start.

I've spent the last hour or so searching for stuff relating to a folder's
contents but can't find much - and don't know how to use what I have found.

Cheers,

Ian.

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

Re: Examine Folder
Date: 28.08.02 17:52 (Wed, 28 Aug 2002 12:52:36 -0400)
From: George Clark
On 8/28/02 12:41, Ian Devaney wrote:

> t seems like an AppleScript should do the trick - but this means I'm stuck
> again!
>
> I've only ever used very simple AppleScripts (usually written by other
> people!) so I really don't know where to start.
>
> I've spent the last hour or so searching for stuff relating to a folder's
> contents but can't find much - and don't know how to use what I have found.

on run{folderPath}
tell application "Finder"
return (size of folder folderPath)
end tell
end run

Supply folderPath as an absolute path string. Should give the same result as
Finder's 'Show Info'.

George