Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching files in a folder !



On 11/15/04 5:44 PM, Sandeep Kanwal didst favor us with:

> Hi,
> 
> I am looking for some help searching files on Mac OS X !!
> First question is which function should I use out of the following:
> 
> FSCatalogSearch() or
> PBCatalogSearchSync() or
> PBCatalogSearchAsync()
> 
> What is the difference I could not understand from the Apple
> documentation maybe I have limited understanding.
> I tried to play around with PBCatalogSearchSync() function and tried to
> search for the files in a folder but the confusing part was this
> documentation...
> 
> "Currently, this iterator must be created with the kFSIterateSubtree
> option and the container must be the root directory of a volume. See
> FSIterator for more information on the FSIterator data type."
> 
> What does this mean ?
> Does this mean that the folder user selects to search should be like
> "Macintosh HD:Folder1"
> and deeper levels will fail like "Macintosh HD:Folder1:Folder2"

No. It says the root directory. That would be Macintosh HD.

> Confused by above I tried searching the volume as follow:
> /* spec is the FolderSpec */
> err    = FSGetVolumeInfo( spec->vRefNum, 0, NULL, kFSVolInfoNone, NULL,
> NULL, &rootFSRef );
> err = FSOpenIterator( &rootFSRef, kFSIterateSubtree, &iterator );
> 
> But this will search the files on whole volume

Yes.

> which may take a lot of
> time and then I have to filter the files for the user selected folder ?

Yes.

There's no support for searching a specific directory. To do that you have
to iterate over the directory with FSGetCatalogInfoBulk and filter the items
manually.

Larry

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Searching files in a folder ! (From: Sandeep Kanwal <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.