Solved

VB 2012 List Files on Web

Posted on 2013-12-29
3
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

628 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