获取URL的所有文件夹

编程入门 行业动态 更新时间:2024-10-07 06:41:36
本文介绍了获取URL的所有文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好我正在尝试从给定服务器读取所有文件。我想做什么:

Hi I'm trying to read all files from a given server. What I want to do:

  • 阅读所有文件夹
  • 获取文件夹中的文件URL

我试过这个来获取我的服务器的文件夹和文件,但是它返回了一个包含我的MacBook文件夹的数组: / p>

I tried this to get the folders and filey of my server, but it returned me an array with the folders of my 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/" )

任何人都可以帮我找到答案吗?我真的很困惑,谷歌没有找到一个好的解决方案或教程。

Can anyone help me to find the answer? I'm really confused and Google didn't find a good solution or tutorial.

非常感谢, mavrick3。

Thanks a lot, mavrick3.

推荐答案

您无法使用NSFileManager访问远程文件夹。该类只能访问本地目录。 如果您的服务器支持FTP连接,那么您可以使用CFFTPStream。 CFFTPStream Reference

You can not make use of NSFileManager to access the remote folders. This class is able to access the local directories only. If your server supports FTP connection then you can make use of CFFTPStream. CFFTPStream Reference

更多推荐

获取URL的所有文件夹

本文发布于:2023-05-28 00:46:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/308229.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:词库加载错误:Could not find file 'D:\淘小白 高铁采集器win10\Configuration\Dict_Sto

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!