On Aug 21, 2008, at 11:29 PM, Adil Saleem wrote:

Hi,

I want to display in a tableview, list of all media files (audio, video files) present in a certain directory.

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.

Thanx in advance

Hi!

Would -[NSArray pathsMatchingExtensions:] work for you, when used with the directory contents array?

pathsMatchingExtensions:
Returns an array containing all the pathname elements in the receiver that have filename extensions from a given array.

- (NSArray *)pathsMatchingExtensions:(NSArray *)filterTypes

Parameters
filterTypes
An array of NSString objects containing filename extensions. The extensions should not include the dot (“.”) character.

Return Value
An array containing all the pathname elements in the receiver that have filename extensions from the filterTypes array.

Availability
Available in Mac OS X v10.0 and later.
Declared In
NSPathUtilities.h


Cheers,
        Andrew

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to