Results 1 to 7 of 7

Thread: Is there an easier way to download a folders contents from a website?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Is there an easier way to download a folders contents from a website?

    Hi there folks! I am working on a program to teach my class at home. So far the program will download a textfile each day that has a list of workpages. Then the program reads the textfile, downloads the work, and the students work away. So far it works great, I'm not complaining, but was wondering if there another way to download a folder.

    Basically the website has a bunch of folders with date stamps in formats, ex: 09-04-20202. The program looks for the folder, and I was wondering if it could just download whatever worksheets was in there without the need for the textfile with the list of contents?

    Thanks!

  2. #2
    The Idiot
    Join Date
    Dec 2014
    Posts
    3,013

    Re: Is there an easier way to download a folders contents from a website?

    Im not 100% sure, was long time ago I worked with http/html.
    one way is;
    if you control the http server and you allow "directory" Listing (similar to ftp) you can use this to allow the client to read the directory and download all files.
    for such thing you can use winsock or similar that will download the information,
    once you have the listing, you can use the download API.
    Last edited by baka; Apr 9th, 2020 at 10:38 PM.

  3. #3
    Addicted Member
    Join Date
    Jun 2018
    Posts
    189

    Re: Is there an easier way to download a folders contents from a website?

    Hi,

    Just an idea.
    How about maintaining zip files, then download and extract.

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Re: Is there an easier way to download a folders contents from a website?

    Both of your ideas sound good! Can vb6 extract zip files?

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Re: Is there an easier way to download a folders contents from a website?

    I have a follow up question. If I did use winsock to get a directory listing, how would I do that? : )

  6. #6
    The Idiot
    Join Date
    Dec 2014
    Posts
    3,013

    Re: Is there an easier way to download a folders contents from a website?

    if u allow "directory listing", you can use winsock or inet to download the information you get from that link.
    Im not sure, since it was +10 years ago I worked with anything like that.
    Inet is easier to use I think, while winsock u need to understand the "http" protocol to create a handshake with the http server.
    but it should not be that hard to make.
    Im sure someone in here can help you how to download the directory listing using Inet.

  7. #7
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,187

    Re: Is there an easier way to download a folders contents from a website?

    > The program looks for the folder, and I was wondering if it could just download whatever worksheets was in there without the need for the textfile with the list of contents?

    In http there is no concept of a folder the way there are directories in ftp protocol. When you access a path like httр://www.myserver.com/justin_m/09-04-20202 it is the web server that creates an html page listing all the files in a certain folder on C: disk and wrapping these names in links (so calles A tags) with correct path on server so that when clicked the web server will serve this very file from local C: disk.

    It is as if the web server automagically creates your textfile, listing all the files in a local folder on C: and here comes the problem -- there is no standard format for this "directory listing". IIS vs Apache vs nginx vs any-other-web-server all produce different "directory listing" which as an added bonus can be customized by the web server administrator to include links to home pages, terms of service and whatever. Now try to parse this html output and figure out which link is a file you need to download :-)) Not that it's impossible but will need some regex kung-fu or lots of calls to VB6 built-in string functions probably.

    You don't need low-level winsock to download files/directory listing from a web server. WinHTTP or MSXML web-requests will do the job easier (search the forums for more info).

    cheers,
    </wqw>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width