ipad - iphone: how do I obtain a list of all files with a given extension on the app's document folder? -
I have saved all my files using it like this
NSString * fileName = [NSString StringWithFormat: @ "% @. Plist", myName]; NSArray * path = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, yes); NSString * document directory = [path item overindexx: 0]; NSString * appfile = [document directory stringbappingpontcontent: filename]; [MyDict writeToFile: send an atomic app: yes]) // Where myDic is a dictionary that contains the value of all the parameters that I want to save.
All these files were saved with the .plist extension. There are several JPG and PNG files in the same directory.
Now, I have all on that directory. How do I get a list of Plist files?
You can use the following calls to receive a given The list of all files in the path that was followed, and then re-run through any filing list with the .plist extension:
NSDirectoryEnumerator * dirEnum = [[NSFileManager defaultManager] EnumeratorEightPath: DocsDir]; NSString * file; {File ([[Direction next object]) {if ([[file pathextension], exceltoosting: @ "flist"]) {// process document}}
Comments
Post a Comment