Solved

VB 2012 List Files on Web

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

Suggested Solutions

Title # Comments Views Activity
XML error not understood 5 31
sql server connection string in config file 4 41
Subtract dates in vb.net 6 34
ErrorKind in crystal reprot VB.Net 1 15
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…
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…
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…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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