I’m using contentsOfDirectoryAtURL to get a listing of a particular directory. Is there a simple way to get just the directory names, rather than the full path?
For example, instead of:
file://localhost/var/mobile/Applications/.../Documents/MySavedFiles/1872399DDF
file://localhost/var/mobile/Applications/.../Documents/MySavedFiles/3431109ABE
I want just
1872399DDF
3431109ABE
Thanks.
First convert the NSURLs into NSStrings, and then you can extract the directory name.
Some very useful methods for NSString are lastPathComponent and stringByDeletingPathExtension