I need to do a script for download images resursive, How can i do it. I am on a Windows.
I want something like this:
for(int i = 0 ; i < 100; i++) { wget "http://download/img" + i + ".png } How can i do this with a Windows Batch script?
I need to do a script for download images resursive, How can i do it. I am on a Windows.
I want something like this:
for(int i = 0 ; i < 100; i++) { wget "http://download/img" + i + ".png } How can i do this with a Windows Batch script?
The Windows equivalent to that sort of for loop is for /L. Syntax is
for /L %%I in (start,step,finish) do (stuff) See help for in a console window for more info. Also, Windows batch variables are evaluated inline. No need to break out of your quotes.
for /L %%I in (0,1,100) do ( wget "http://download/img%%I.png" ) ... will download img0.png through img100.png with no numeric padding.
If the numbers are zero padded, there's an added element to consider -- delayed expansion. Within a for loop, variables are evaluated before the for loop loops. Delaying expansion causes the variables to wait until each iteration to be evaluated. So, zero padding then taking the right-most 3 characters requires something like this:
setlocal enabledelayedexpansion for /L %%I in (0,1,100) do ( set "idx=00%%I" wget "http://download/img!idx:~-3!.png" ) ... which will download img000.png through img100.png.
There are some parameters that can be used with wget including a recursive mode and also extension filter.
Please have a look at here