0

I want to find all markdown files within the user's home directory. The solution has to be very efficient, because this folder contains mostly a great heap of different files.

How to skip hidden files/folders by using a NSDirectoryEnumarator? I only found a solution by using URLs and not string-paths.

NSString *path = NSHomeDirectory();
NSFileManager *fileManager = [NSFileManager defaultManager];
NSDirectoryEnumerator *directoryEnum = [fileManager enumeratorAtPath:path];

//some type of filter

NSString *file;

while (file=[directoryEnum nextObject]){

    if([file hasSuffix:@".md"]){
        //yes it's markdown
    }
}
Community
  • 1
  • 1
NaN
  • 3,501
  • 8
  • 44
  • 77

0 Answers0