Find all files in iphone project
Question
I'm curious if there's a way to search for files in the iPhone's directory ( the location is irrelevant).
I am wanting to load in addresses from text files. The thing is additional files may be added and I want to dynamically be able to find the files and load in the data without hardcoding the file names to load in.
Thanks a bunch!
Solution
You want:
NSError *error;
[[NSFileManager defaultManager] contentsOfDirectoryAtPath:myPath error:&error]
It returns an array of NSString objects for each file in the given directory.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow