• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File Extensions Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Extensions Problem


  • Subject: Re: File Extensions Problem
  • From: Andrew Merenbach <email@hidden>
  • Date: Sun, 24 Aug 2008 21:21:35 -0700

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 (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

References: 
 >File Extensions Problem (From: Adil Saleem <email@hidden>)

  • Prev by Date: Re: Semi-transparent, blurred NSWindow background?
  • Next by Date: Re: *** -[NSSavePanel _blocksActionWhenModal:]: message sent to deallocated instance 0x15a05e50
  • Previous by thread: Re: File Extensions Problem
  • Next by thread: Re: File Extensions Problem
  • Index(es):
    • Date
    • Thread