嗨我試圖從給定的服務器讀取所有文件。我想做什麼:獲取URL的所有文件夾
- 閱讀所有的文件夾
- 獲取
我想這讓我的服務器的文件夾和法利的文件夾裏面的文件URL,但它返回我的陣列我的MacBook的文件夾:
NSURL *directory = [NSURL URLWithString:@"linktoserver"];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error = nil;
self.contentList = [[NSArray alloc] initWithArray:[fileManager contentsOfDirectoryAtURL:directory includingPropertiesForKeys:[[NSArray alloc] initWithObjects:NSURLNameKey, nil] options:NSDirectoryEnumerationSkipsHiddenFiles error:&error]];
if (error != nil) {
NSLog(@"ERROR: %@",[error localizedDescription]);
}
NSLog(@"%@",contentList);
登錄:
> 2011-04-06 15:37:38.413 Bildergalerie[744:207] (
> "file://localhost/Applications/",
> "file://localhost/Benutzerhandbu%CC%88cher%20und%20Informationen",
> "file://localhost/Cancel",
> "file://localhost/Developer/",
> "file://localhost/Library/",
> "file://localhost/opt/",
> "file://localhost/Shockwave%20Log",
> "file://localhost/System/",
> "file://localhost/Users/",
> "file://localhost/usr/")
任何人都可以幫助我找到答案嗎?我很困惑,谷歌沒有找到一個好的解決方案或教程。
非常感謝, mavrick3。