Solved

VB 2012 List Files on Web

Posted on 2013-12-29
3
323 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 74

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now