1

I want to download some file like:

http://example.com/host/file001/file001_0001~0100.jpg
http://example.com/host/file002/file002_0001~0100.jpg
http://example.com/host/file003/file003_0001~0100.jpg
...
http://example.com/host/file100/file100_0001~0100.jpg

so I try some simple cmd like

curl -O http://example.com/host/file[001-100]/file[001-100]_[0001-0100].jpg

but I don't want to acess some url like

http://example.com/host/file001/file002_0001~0100.jpg
http://example.com/host/file010/file020_0001~0100.jpg

./filexxx/filexxx_0001~0100.jpg ...
both xxx are same in url

What command or symbol should I use? Sorry for basic question

Tsuki Sun
  • 13
  • 3

1 Answers1

1

Create a batchfile lime this:

@echo off

setlocal EnableDelayedExpansion

for /l %%f in (1,1,100) do (
    set form=0000%%f
    set value=!form:~-3!
    ECHO curl -O http://example.com/host/file!value!/file!value!_0!value!.jpg
)

If you like the output, remove the ECHO before curl...

more info :

BTW: if you are not using Windows, than please say so, i can convert this to bash too

Luuk
  • 12,245
  • 5
  • 22
  • 33