Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(NSArray *)backupFilesListSorted:(NSString*)folderPath
- {
- NSFileManager *manager = [NSFileManager defaultManager];
- NSArray *files = [manager contentsOfDirectoryAtURL:[NSURL URLWithString:folderPath]
- includingPropertiesForKeys:[NSArray arrayWithObject:NSURLContentModificationDateKey]
- options:NSDirectoryEnumerationSkipsHiddenFiles
- error:nil];
- NSDictionary *dictionary = [[NSMutableDictionary alloc] init];
- for(NSURL *urlfile in files) {
- NSDate *date = nil;
- if ([urlfile getResourceValue:&date forKey:NSURLContentModificationDateKey error:nil]) {
- [dictionary setValue:urlfile forKey:[date description]];
- }
- }
- NSLog(@"dic: %@", dictionary);
- NSArray *sortArray = [dictionary allValues];
- NSLog(@"file: %@", sortArray);
- return sortArray;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement