Is it possible to get a count of XML files added to a Xcode project?
Asked
Active
Viewed 205 times
0
-
Clarify what "external XML files added to the resources of the project" means, and if possible give an example of such a XML file and how it ended up in your project. Further if possible give the REASON for asking this question. – freespace Mar 19 '12 at 05:48
-
I have a project to which i add a certain number of XML files, how do i find out the count of the XML files added? – user1256404 Mar 19 '12 at 06:30
2 Answers
0
In your project directory, execute the following command in the console:
find . -iname '*.xml' | wc -l
This assumes that the xml files were copied to the project directory when they were added. If not, then actual parsing of the project file is required.

freespace
- 16,529
- 4
- 36
- 58
0
Hi I am pretty new to ios development, guess this is not new for many but for those who might need help,here is how i solved it-
NSString *bundleRoot = [[NSBundle mainBundle] bundlePath];
NSFileManager *fm = [NSFileManager defaultManager];
NSArray *dirContents = [fm contentsOfDirectoryAtPath:bundleRoot error:nil];
NSPredicate *fltr = [NSPredicate predicateWithFormat:@"self ENDSWITH '.xml'"];
NSArray *onlyXMLs = [dirContents filteredArrayUsingPredicate:fltr];
NSLog(@"%d is the count",[onlyXMLs count]);
i found the solution from this link - Getting a list of files in a directory with a glob

Community
- 1
- 1

user1256404
- 11
- 4