Solved

VB 2012 List Files on Web

Posted on 2013-12-29
3
335 Views
Last Modified: 2014-01-18
I use VB 2012, and need to download multiple files automatically.

It's easy to download a single file, e.g.

My.Computer.Network.DownloadFile("http://nnn.nnn.nnn.nnn/MyFolder/MyFile.txt", "C:/Temp/MyFile.txt", "MyLogin", "MyPassword", True, 50000, True)

However, I cannot find out how to list all the files in the folder first, so I can then download each one. You'd think it would be My.Computer.Network.GetFiles but there is no such method.

Can anyone help ? It must be VB !
0
Comment
Question by:round3
3 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39745537
You'll only be able to locate all the files in the folder if the server has directory browsing enabled, which is typically off as a security precaution. The only other way to do it would be the way Googlebot does it:  traverse all links on the site--in this instance, you would only get everything if everything is linked.
0
 

Author Comment

by:round3
ID: 39745735
OK, so if I enable directory browsing on my website, what is the VB.Net code to obtain the listing ?
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39754955
There is no direct way of getting the file list from a HTTP directory as far as I know. One option is to use the directory address in WebClient.DownloadString method which will get you the HTML of the page with list of all the files (as seen in IE if you browse the directory) and then you can use some string manipulation/regex to extract the file names.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get hold of longitude and latitude in iframe string 11 49
Regex validation 2 28
Looping through datagridview and dataset ? 6 24
Name Space error VS2015 1 27
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question