Re: File Extensions Problem
Re: File Extensions Problem
- Subject: Re: File Extensions Problem
- From: Phil <email@hidden>
- Date: Fri, 22 Aug 2008 21:27:23 +1200
On Fri, Aug 22, 2008 at 6:29 PM, Adil Saleem <email@hidden> wrote:
> Currently what i am doing is that i am getting the file names in an NSMutableArray using NSFileManager function directoryContentsAtPath
>
> I get the list, but the problem is that it get all the files. I want only those files that have a certain extension (for example mp4, mp3). How can i do that.
>
I'd recommend using -enumeratorAtPath: and adding each path that meets
your criteria to a new array.
Also, consider if you want to check for a particular file extension,
or a particular file type: do you just want files ending in ".mp3", or
any valid MP3 file? If you want the latter, then you should
investigate checking the file extensions for conformance against the
particular UTIs you're interested in. The documentation for UTIs isn't
great, but take a look at the UTType.h and UTCoreTypes.h header files.
Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden