Download multiple extensions file from a website

Hello All,
I want to download pdf, xlsx, XLS files from a website to a particular file path.

I used the below code using invoke code activity:

Dim WC As New system.Net.WebClient
WC.DownloadFile(CurrentRow(“Url”).ToString,“filepath” + inType + “”+ CurrentRow(“Docname”).ToString+ “.pdf”)

Here I removed .pdf cause there were different extensions as well to download but it downloaded empty file, if there is another logic , please help.

Thank you

Hi @Shreya13 ,

I would recomend you to download the files with the default names and file extensions and then use the following methods on the files full path:

  • Get file extension: Path.GetExtension(“You File Path”)

  • Get file name without extension: Path.GetFileNameWithoutExtension(“You File Path”)

With these methods you will have the right extensions for each file and can add the file name you wish.

Hope this helps :slight_smile:

This is for directory path right we can’t use it for website documents

Like if data is getting extracted then after that it should automatically download with the desired extension like pdf xls xlsx etc is there any logic or string query which we can use?