tags:

views:

30

answers:

1

Hello everyone

I just wonder there a way to display the files in document directory with the sequence of modified date.

Welcome any comment

Thanks

interdev

+2  A: 

NSFileManager class provides access to file's attributes.

NSFileManager* manager = [NSFileManager defaultManager];
for (NSString *path in [manager contentsOfDirectoryAtPath: documentsDirectory error:nil]){
   NSDictionary* modDate = [manager attributesOfItemAtPath:
             [documentsDirectory stringByAppendingPathComponent:path] error:nil];
   NSDate* dateModified = (NSDate*)[modDate objectForKey: NSFileModificationDate];
   if (dateModified)
      NSLog(@"%@ .Date modified: %@", path, dateModified);
}
Vladimir
Nice job Vladmir. Good Answer. You rock!
Jordan