I want to search a file and get it in the mac root . I used the subpathsAtPath: of NSFileManager and put the root path "/", but I found that this func searched so deeply and took a long time. I hand known that that the file I want to find in the the next level of root , what func I can used , thanks a lot!
A:
There's no "out of the box" solution for what you want to do. You would need to use the directoryContentsAtPath:
method to get a list of all the objects in the root directory, then loop through those objects, examining the directory contents of each one.
The directoryContentsAtPath:
method returns a list of directories and files, so you'll need to use something like fileExistsAtPath:isDirectory:
in your loop to make sure you only look inside directories.
Alex
2009-07-28 12:41:07