方法1
+ (BOOL)isDirectory:(NSString *)filePath
{
BOOL isDirectory = NO;
[[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDirectory];
return isDirectory;
}
方法2
+ (BOOL)isDirectory:(NSString *)filePath
{
NSNumber *isDirectory;
NSURL *fileUrl = [NSURL fileURLWithPath:filePath];
[fileUrl getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil];
return isDirectory.boolValue;
}