Results 1 to 7 of 7

Thread: Downloading more than one file from web server

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Downloading more than one file from web server

    Hello,

    I am using the web client to download a file. Which works ok.

    However, now I have to download many and the number of files to download will change everyday.

    I am not sure how I can get the web client to know which files have been downloaded or not? I was thinking of using a for loop to download each file. But I will never know how many there are to download?

    The web client could download the same file twice?

    Many thanks for any suggestions,

    Code:
    Private Sub btnStartDownload_Click(ByVal sender As Object, ByVal e As EventArgs)
     Dim client As New WebClient()
     AddHandler client.DownloadProgressChanged, AddressOf client_DownloadProgressChanged
     AddHandler client.DownloadFileCompleted, AddressOf client_DownloadFileCompleted
     
     ' Starts the download
     client.DownloadFileAsync(New Uri("UrlFilePath"), "DownloadPath")
     
     btnStartDownload.Text = "Download In Process"
     btnStartDownload.Enabled = False
    End Sub
    steve

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Downloading more than one file from web server

    Unless you somehow get a list of the files available for download from the webserver and you maintain a list of downloaded files yourself which you can then compare the 2 lists to figure out which file has not been downloaded, I don't think you can tell the webclient to download only files that has not been downloaded.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Re: Downloading more than one file from web server

    Hello,

    Thanks for your response.

    I can maintain a list of files myself that I can download and compare. But I think I would have to download it first then compare. And it could keep trying to download the same file. I think I might end up going round in circles.

    Is there a way to get the number of files that are on the web server?

    Many thanks,
    steve

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Downloading more than one file from web server

    Quote Originally Posted by steve_rm View Post
    Is there a way to get the number of files that are on the web server?
    Short answer: No.
    Unless: you own that website and you have to modify the website to provide you with smoe mechanism to get the list of files available (a webservice or simply another webpage that list out the files)
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  5. #5
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    407

    Re: Downloading more than one file from web server

    I like to use flashfxp.. It's easy. Visual Studio is good for writing code. Leave it that way.
    My Websites
    SharpMP3 - MP3 Design Articles www.sharpmp3.com
    Yobbers - Job Search www.yobbers.com
    Lets Trend - Methods For Riding Stock Trends www.letstrend.com

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Re: Downloading more than one file from web server

    The flashfxp is not a solution for this issue.

    Thanks anyway
    steve

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Downloading more than one file from web server

    You have to retrieve something from the server to compare to something local. Depending on circumstances that could be the file timestamp, a hash of the contents or the actual contents.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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