Monday, October 22, 2012

Remove .DS_Store file while retrieving data files from document directory in IOS


NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
    NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
    NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"MyFolder"];
   NSMutableArray *fileListArray = [[[NSMutableArray alloc]init] autorelease];
    for (NSString *file in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:dataPath error:nil])
    {    
        NSString *filePath = [dataPath stringByAppendingPathComponent:file];
        if ([filePath rangeOfString:@".DS_Store"].location!=NSNotFound) {
        }else{
            [fileListArray addObject:filePath];
        }
        
        
    }

1 comment:

  1. Greeting Pengelola
    Thanks for response .
    How can i assist you in your new product? pls drop me that in my mail id - adhikari.vijay05@gmail.com

    ReplyDelete