How do I download multiple files one after another?

283 Views Asked by At

I have two questions. I use " curl " for downloading files via Command prompt. if there is any other way, please tell me.

The first one is, how I can download multiple files one after another with PowerShell or cmd with one character difference.

like part-1.mp4 up to part-150.mp4

C:\Users\Omar\Downloads\Video\Complete CCNA from Associate to CCNA Expert>curl -O http://cdn3.amoozesh.af/drive1/Amoozesh/CCNA-2016-Complete/Part-1.mp4 "How i can add multiple downloads one after another part-150.mp4

The second one is, how I can download the Folder itself without going to download file by file as shown in I photo and command.

C:\Users\Omar\Downloads\Video\Complete CCNA from Associate to CCNA Expert>curl -O http://cdn3.amoozesh.af/drive1/Amoozesh/CCNA-2016-Complete <<< in here the folder is shown. is it possible to download a folder via the same URL?

enter image description here

1

There are 1 best solutions below

0
user4317867 On BEST ANSWER

Moving comment to an Answer:

(Editing to mention Stack Overflow can help with answering a question or two, ultimately you'll learn better by researching answers on your own but asking on here when you run into some trouble)

The Command-prompt has a For loop where you can run a command as a loop.

For help its: For /? and check online for more specific examples.

Eg: FOR /L %a IN (1,1,150) DO Echo "curl -O https://website.com/part-%a.mp3"

Keeping in mind that the above For loop only writes the text to the screen as a way of ensuring the command looks correct, when you get the output looking correct, remove the ECHO and make the command FOR /L %a IN (1,1,150) DO curl -O https://website.com/part-%a.mp3

In PowerShell curl is an alias for Invoke-WebRequest so you'd need to work on a loop in PowerShell doing curl or Invoke-WebRequest.

Eg: 1..150 | ForEach-Object { "Invoke-WebRequest -uri https://website.com/part-$Psitem.mp3" }

Keep in mind the Powershell example only writes a string to the console, when you have the output looking correct you can make the actual command:

1..150 | ForEach-Object {

Invoke-WebRequest -uri https://website.com/part-$Psitem.mp3"

}