List web file folder

1

I'm trying to list a files folder, I'm not getting it,

The error says that directoryinfo does not support URLs.

DirectoryInfo directoryinfo = new DirectoryInfo("http://127.0.0.1");
IEnumerable<FileInfo> fileList = directoryinfo.GetFiles();
    
asked by anonymous 14.05.2017 / 20:40

1 answer

1

There is no way for HTTP to do this in this way. In fact there will have to be API and remote access that will allow you to do HTTP.

If you just want to get the data on the network and can be by any protocol there you can do direct access, as you would do in Windows, like this:

var fileList = Directory.EnumerateFiles(@"\127.0.0.1");

I placed it on GitHub for future reference .

Of course you also need to have access to the machine, which is right in localhost , and you probably need to specify the directory to work.

I used EnumerateFiles() because it performs better.

    
14.05.2017 / 20:55