Ignore hidden files and directories with obj-c

Solutions Collect From Internet About “Ignore hidden files and directories with obj-c”

Use NSFileManager with NSDirectoryEnumerationSkipsHiddenFiles.

For example:

NSFileManager *fileManager = [NSFileManager defaultManager];

NSArray *theFiles =  [fileManager contentsOfDirectoryAtURL:[NSURL fileURLWithPath:@"/Users/Anne/Desktop/"]
                                includingPropertiesForKeys:[NSArray arrayWithObject:NSURLNameKey]
                                                   options:NSDirectoryEnumerationSkipsHiddenFiles
                                                     error:nil];

NSLog(@"%@",theFiles);