如何从网站获取文件夹列表 [英] How to get list of folders from a website

查看:128
本文介绍了如何从网站获取文件夹列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从网站获取文件夹列表?也就是说,我写了一个带URL的程序并从网站上给出一个文件夹列表。

我试试

how can i get a list of folders from a website? Namely I wrote a program that take a URL And give a list of folders from the website.
I try

Directory.GetDirectories(myURL)



但它不起作用。


but it not work.

推荐答案

考虑到很少的网站给你浏览访问他们的文件系统,您将很难找到该工具可以使用的网站。



Directory类仅适用于本地文件系统。它不能通过HTTP工作,这意味着你不能用它来获取网站上的目录列表。



你必须在网上使用HttpWebRequest类URL并解析您返回的结果(如果有)。
Considering very few websties ever give you browse access to their file system, you're going to have a hard time finding a website that this tool will work with.

The Directory class only works with local file systems. It will not work over HTTP, meaning you can't use it for getting the list of directories on a website.

You would have to use the HttpWebRequest class with web URLs and parse the result you get back, if any.


这篇关于如何从网站获取文件夹列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆