I wish to find a specific named file, and get a path ref to it.
So far, I have done this,which is extremely inelegant.
What I end up with are a lot of paths that have the Directory desktop, ( which is what I want ( indirectly)), but what I really want is a specific file on the desktop in a folder called "Chapter 7".
Is there an elegant way of finding the specific file .
The reason I want to do this programmatically is that the file name is "/Users/m/Desktop/Chapter\ 7/7-7/Exercise_2.0_Ch7_7.m" and I want to avoid using the escape characters...if that makes any sense.
Anyway...an approach would be most helpful.
Thank you.
So far, I have done this,which is extremely inelegant.
Code:
while ( (path = [ dirEnum nextObject]))
{
NSLog(@"%@", path);
[ fm fileExistsAtPath: path isDirectory: &flag];
found = [path rangeOfString: @"Desktop"];
if ( flag != NO && found.location == NSNotFound )
[dirEnum skipDescendents];
}
What I end up with are a lot of paths that have the Directory desktop, ( which is what I want ( indirectly)), but what I really want is a specific file on the desktop in a folder called "Chapter 7".
Is there an elegant way of finding the specific file .
The reason I want to do this programmatically is that the file name is "/Users/m/Desktop/Chapter\ 7/7-7/Exercise_2.0_Ch7_7.m" and I want to avoid using the escape characters...if that makes any sense.
Anyway...an approach would be most helpful.
Thank you.